필터 지우기
필터 지우기

Getting errors while using fplot

조회 수: 3 (최근 30일)
Gregorio Garza Treviño
Gregorio Garza Treviño 2022년 9월 4일
답변: Chunru 2022년 9월 4일
Ive been working on a little assignment, however, when I go to plot the results I get some strange behaviour. I cant add color specififcations, line width specifications, limits, legend, or even a hold off without getting a massive yellow text box saying "Warning: Error updating ParametrizedFunctionLine" and as soon as I delete said things, the message dissapears.
Any idea on how I can fix this?
And the full code is this:
syms v(t) s(t)
g = 9.8;
EQv = diff(v) == -g;
cond = v(0) == 105;
v(t) = dsolve(EQv, cond)
v(t) = 
EQs = diff(s) == v(t);
cond = s(0) == 0;
s(t) = dsolve(EQs, cond)
s(t) = 
tmax = 150/7
tmax = 21.4286
syms vr(t) sr(t)
k = 0.003;
EQv2 = diff(vr) == -g-k*vr;
cond = vr(0) == 105;
vr(t) = dsolve(EQv2,cond)
vr(t) = 
EQs2 = diff(sr) == vr;
cond = sr(0) == 0
cond = 
sr(t) = dsolve(EQs2,cond)
sr(t) = 
fplot(s(t), [0 tmax], 'Color', 'blue', 'LineWidth', 2)
hold on
r = solve(sr(t)==0)
r = 
fplot(sr(t),[0 r], 'Color', 'red', 'LineWidth', 2)
legend('Sin resistencia','Con resistencia')
hold off
Warning: Error updating ParameterizedFunctionLine.

The following error was reported evaluating the function in FunctionLine update: Non-scalar in Uniform output, at index 1, output 1.
Set 'UniformOutput' to false.

채택된 답변

Chunru
Chunru 2022년 9월 4일
syms v(t) s(t)
g = 9.8;
EQv = diff(v) == -g;
cond = v(0) == 105;
v(t) = dsolve(EQv, cond)
v(t) = 
EQs = diff(s) == v(t);
cond = s(0) == 0;
s(t) = dsolve(EQs, cond)
s(t) = 
tmax = 150/7
tmax = 21.4286
tmax = 21.4286
tmax = 21.4286
syms vr(t) sr(t)
k = 0.003;
EQv2 = diff(vr) == -g-k*vr;
cond = vr(0) == 105;
vr(t) = dsolve(EQv2,cond)
vr(t) = 
EQs2 = diff(sr) == vr;
cond = sr(0) == 0
cond = 
sr(t) = dsolve(EQs2,cond)
sr(t) = 
fplot(s(t), [0 tmax], 'Color', 'blue', 'LineWidth', 2)
hold on
r = solve(sr(t)==0)
r = 
sr
sr(t) = 
fplot(sr(t),[0 double(r)], 'Color', 'red', 'LineWidth', 2) % interval should be double to avoid warning
legend('Sin resistencia','Con resistencia')
hold off

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Formula Manipulation and Simplification에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by