Data is being graphed as line instead of sin wave

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by