MATLAB: About plot function with 4 variable in term of 1 variable %s I want to draw a function (is s) in terms of g can you help me? >> syms t>> a=t/n;>> syms g>> s=(g*exp(-a*g))/(g*(1+2*a)+exp(-a*g)) Best Answer Something like this?syms s(g,t,n)s=(g.*exp((-t./n).*g))./(g.*(1+2.*(t./n))+exp((-t./n).*g));nn=subs(n,1);tt=subs(t,0:0.1:5);gg=subs(g,1);s=vpa(subs(s,{g,t,n},{gg,tt,nn}),4);plot(tt,s) Related SolutionsMATLAB: Derivative of a Function If you have the Symbolic Toolbox:>> g = @(x) exp(x^2-2)g = @(x)exp(x^2-2)>> syms x>> diff(g(x))ans =2*x*exp(x^2 - 2) MATLAB: Why exp(a*t) is not equal to ilaplace ((s*i-a)^-1) in matlab The matrix exponential e^At = L^-1 {(sI-A)^-1}This does not mean you can just take exp of each of the elements of the matrix.This is wrongMatrix exponential:e^(At) =/= exp(A*t) = [ exp(-3*t), exp(-t) ; exp(2*t), 1]MATLAB does element wise operation of matrices hence you can't compute the matrix exponential by the above method.Maybe this will give you a better idea of how it is defined:http://en.wikipedia.org/wiki/Matrix_exponential#via_Laplace_transform Related QuestionUse index in anonymous functionHow to write matlab code for the below equations
Best Answer