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.

 채택된 답변

KSSV
KSSV 2022년 7월 12일

1 개 추천

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.

댓글 수: 1

Tuan
Tuan 2022년 7월 15일
Thanks KSSV, It's been a really big problem for me cause I've been debugging it for a week now, anw thank you a lot.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

제품

릴리스

R2019a

태그

질문:

2022년 7월 12일

댓글:

2022년 7월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by