MATLAB Answers

how to calculate the maximum value of a function assigned to a 'sym'?

15 views (last 30 days)
Debashish Ray
Debashish Ray on 23 Oct 2017
Answered: Karan Gill on 23 Oct 2017
I solved a differential equation and stored the solution in y which is of type 'sym'. But I can't use the 'max' function with it. following is the code:-
eqn= 'Dy+y/(8*(10^5)*5*(10^(-6)))=12/(8*(10^5))';
inits= 'y(0)=0';
y=dsolve(eqn,inits,'t');
soln= ['y(t)=',char(simplify(y))];
disp(soln)
ezplot(y)
max(y)
dy=diff(y);
max(dy)
The 'max' functions are not working.

  0 Comments

Sign in to comment.

Answers (1)

Karan Gill
Karan Gill on 23 Oct 2017
The max function does not find the maximum of a symbolic function. Please read the doc on max.
Your question is a math question, not a MATLAB question. You can look up a reference like http://clas.sa.ucsb.edu/staff/lee/Max%20and%20Min's.htm

  0 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by