Error when using variable in axis

조회 수: 2 (최근 30일)
Niklas Kurz
Niklas Kurz 2021년 5월 23일
편집: Matt J 2021년 5월 23일
I've:
syms w we B U
A = (w*U)/(sqrt((-w^2+we)^2+(B*w)^2));
syms R L C
Aw = subs(A,{B,we},{R/L,1/(L*C)});
fplot(subs(Aw,{U,R,L,C},{1,1,1,1}))
Amax = subs(Aw,{U,R,L,C,w},{1,1,1,1,1/sqrt(1*1)});
Actually that code above is not that of importance. The real problem occurs, when
axis([0 10 0 Amax])
is set. I can't really grasp why this gives an error. Amax just equals 1.
axis([0 10 0 1])
works nonetheless. Must be caused by subs probably

채택된 답변

Matt J
Matt J 2021년 5월 23일
편집: Matt J 2021년 5월 23일
Must be caused by subs probably
Yes, subs() does not give numeric output. You must convert it to numeric with double() or similar.
axis([1 1 1 double(Amax)])

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Oceanography and Hydrology에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by