How can I fix this error?
Why I am getting "Error Using Plot , invalid color or line type " in line 15
25 次查看(过去 30 天)
显示 更早的评论
回答(2 个)
Vignesh Murugavel
2021-8-4
3 个评论
Walter Roberson
2021-8-4
On line 15 of your code you have '-5'. What did you intend by the 5 part of that?
reza
2023-11-11
编辑:Walter Roberson
2023-11-12
clc;
clear;
close all;
y=-1:10;
G=1:10;
c=5;
t=10;
D=3;
u_y='((-G*y^2)/2)+(c*y)+(t*y)+(4((t^(1/2)/3*G)*((c-G*y)^(3/2))+D)';
plot(y,u_y)
xlabel('y')
ylablel('u_y')
2 个评论
Walter Roberson
2023-11-12
y=-1:10;
G = (1:10).';
c=5;
t=10;
D=3;
u_y=((-G.*y.^2)/2)+(c.*y)+(t.*y)+(4.*((t.^(1/2)/3.*G).*((c-G.*y).^(3/2))+D));
plot(y,u_y)
xlabel('y')
ylabel('u_y')
Walter Roberson
2023-11-12
Note that your y and G are different sizes -- 12 and 10 -- so you cannot combine them by element-by-element operations... not unless you transpose one of them and use implicit expansion.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Stateflow Programmatic Interface 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!