Error using plot Data
2 ビュー (過去 30 日間)
古いコメントを表示
I have an error that I put in the last comment of the code, I have a homework to plot a function which I delare in the code too. I'm new to this matlab language, please help me figure it out, thanks a lot.
function BTL
clear
clc
%%INPUT / DATA
%a = input('Value of a:')
%b = input('Value of b:')
%c = input('Value of c:')
a=1;
b=1;
c=1;
syms t;
%v = a*cos(b*t)*i + c*x*j;
vx = a*cos(b*t);
xt = int(vx,t);
vy = c*xt;
yt = int(vy,t);
%%FIGURE
t = [0:1:10];
figure
plot(t,yt);
xlabel('y(t)');
ylabel('t');
title('Quy dao cua chat diem');
grid on;
axis equal;
end
%%Error
%Error using plot
%Data must be numeric, datetime, duration or an array convertible to double.
0 件のコメント
採用された回答
KSSV
2022 年 7 月 12 日
clear
clc
%%INPUT / DATA
%a = input('Value of a:')
%b = input('Value of b:')
%c = input('Value of c:')
a=1;
b=1;
c=1;
syms t;
%v = a*cos(b*t)*i + c*x*j;
vx = a*cos(b*t);
xt = int(vx,t);
vy = c*xt;
yt = int(vy,t);
%%FIGURE
t = 0:1:10;
yt = double(subs(yt,t)) ; %<---convert sym class to double by substituting t
figure
plot(t,yt);
xlabel('y(t)');
ylabel('t');
title('Quy dao cua chat diem');
grid on;
axis equal;
%%Error
%Error using plot
%Data must be numeric, datetime, duration or an array convertible to double.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!