How to plot time against acceleration in my code?
古いコメントを表示
Hi! I'm new to Matlab and trying to understand the basics, but I've run into a problem. I have imported data from an excel sheet about the trajectory of a small marble, but when I try the plot acceleration (ax or ay) against the time (t), all values of ax and ay are plotted against one t value! I assume this problem emerges because I am using diff(vx) to differentiate my velocity functions... How can I change my code in order to plot these values against their corresponding ts? Thanks in advance!
x=xlsread('marble excel.xlsx','B2:B26');
y=xlsread('marble excel.xlsx','C2:C26');
t=xlsread('marble excel.xlsx','A2:A26');
vx=x/t;
vy=y/t;
ax=diff(vx);
ay=diff(vy);
plot(t,ax)
hold
plot(t,ay)
採用された回答
その他の回答 (1 件)
Vinayak
2025 年 4 月 1 日
0 投票
x=xlsread('marble excel.xlsx','B2:B26');
y=xlsread('marble excel.xlsx','C2:C26');
t=xlsread('marble excel.xlsx','A2:A26');
vx=x/t;
vy=y/t;
ax=diff(vx);
ay=diff(vy);
plot(t,ax)
hold
plot(t,ay)
カテゴリ
ヘルプ センター および File Exchange で Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!