Here is my code (the error is in plotting Vg):
fplot differentiated symbolic equation
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello there!
I'm trying to use the fplot function to plot an equation that I defined previously. However I think because I used syms and the diff() function to create the variable I am trying to plot, it is messing up the fplot function. My output is one graph which I already got to plot and an orange error message saying: '''The following error was reported evaluating the function in FunctionLine update: sym output type is not supported. Set 'UniformOutput' to false.'''
Any ideas for how to solve this? All other threads talk about arrayfun or something unrelated, if not, no worries, but thanks!
채택된 답변
Star Strider
2017년 11월 8일
I would calculate the derivative and create the anonymous function for ‘Vg’ with:
Vg = matlabFunction(diff(Mg,t), 'Vars',{t});
With that change, it runs without error, although the plot generates a long ‘Warning’ message.
댓글 수: 2
추가 답변 (2개)
Karan Gill
2017년 11월 8일
You made a simple mistake. You used anonymous functions instead of symbolic functions. Declare a symbolic function using
syms Va(t)
Va(t) = t^2;
and plot it with fplot
fplot(Va)
Comment if you have issues. If it works, please accept this answer.
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!