Clear Filters
Clear Filters

Data is being graphed as line instead of sin wave

4 views (last 30 days)
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?

Answers (1)

Image Analyst
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.

Categories

Find more on MATLAB 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!