Data is being graphed as line instead of sin wave

1 回表示 (過去 30 日間)
Snow
Snow 2023 年 6 月 16 日
回答済み: Image Analyst 2023 年 6 月 16 日
My x and y variables have about 964 data points each. When I plot them in excel, It just comes out linear, when it should be sinusodial. When I tried doing it in excel I did get a sinusoddial wave.
Im suspecting its because of the way my data is formated? I am exporting this data from tracker and it paste into matlab as
"time =[0.00E+00
3.33E+00
6.67E+00
1.00E+01
1.33E+01
1.67E+01
2.00E+01
2.33E+01
2.67E+01
...]" and the same for position.
Is this happening because the format of my data? Or is there something else I am doing wrong?

回答 (1 件)

Image Analyst
Image Analyst 2023 年 6 月 16 日
Should be okay but it looks like you're only plotting time/x. You need to plot y/position as a function of that.
timeData = [.........
position = [....................
plot(timeData, position, 'b-', 'LineWidth', 2);
grid on;
xlabel('Time');
ylabel('Position');
Don't use "time" as the name of your variable since it's already the name of a built-in function. Call it timeData or something.

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by