Effacer les filtres
Effacer les filtres

Data is being graphed as line instead of sin wave

2 vues (au cours des 30 derniers jours)
Snow
Snow le 16 Juin 2023
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?

Réponses (1)

Image Analyst
Image Analyst le 16 Juin 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.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by