Data is being graphed as line instead of sin wave
4 views (last 30 days)
Show older comments
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?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1412159/image.png)
0 Comments
Answers (1)
Image Analyst
on 16 Jun 2023
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.
0 Comments
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!