필터 지우기
필터 지우기

plotting simple symbolic equation

조회 수: 2 (최근 30일)
Sean Smith
Sean Smith 2011년 11월 11일
I'm new to using symbolic equations and variables. I am trying to plot this symbolic equation but I keep getting an error saying Maximum recursion limit of 500 reached. also when I type h into matlab to see the equation it shows the first value -0.12 as - 0.12000000000080035533756017684937 I don't get why it does this and it just does it to that coefficient. And the g value has an obnoxious amount of decimal places and I'm using format short. It's a trajectory equation, so g is when the ball hits the ground.
syms t
h=sym('-0.12*t^4+12*t^3-380*t^2+4100*t+220');
g=solve('-0.12*t^4+12*t^3-380*t^2+4100*t+220=0');
g=g(2) %only answer that makes sense
figure; ezplot(h,[0,g]);

답변 (1개)

bym
bym 2011년 11월 11일
where to begin...
first since you have declared t to be symbolic, you can define your equation to be
eq = -0.12*t^4+12*t^3-380*t^2+4100*t+220 % no quotes
sol = solve(eq) % solve the equation matlab assumes it's =0
vsol = vpa(sol,5) % takes care of your 'obnoxious' decimal places
ezplot(char(eq),[0 max]) % plot function - note conversion of symbolic to character

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by