Repeating x-axis for rectangular signal
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
youjarr
el 24 de En. de 2019
Comentada: Star Strider
el 26 de En. de 2019
Hey guys,
i have an rectangular signal i want to plot.
On the Y axis is the voltage from 0 to 3.3 V (24945x1 single) and on the X axis is the position of the motor (circle) from 0-360°. (24945x1 double)
I have both signals but like I exprected it when I do
plot(Angle, Voltage)
it is not working like i wish. How can i let the X axis repeat it self and not overlapping the other datapoints.
0 comentarios
Respuesta aceptada
Star Strider
el 24 de En. de 2019
Try something like this:
Angle = reshape(([1; 1; 1]*(0:359))', 1, []); % Create Data;
Voltage = reshape(sind([1; 10; 20]*(0:359))', 1, []); % Create Data;
figure
plot(Angle, Voltage) % Original Plot
contAngle = unwrap(Angle*pi/180)*180/pi; % Use ‘unwrap’ To Recover Serial Vector
figure
plot(contAngle, Voltage) % ‘Unwrapped’ Plot
xt = get(gca, 'XTick');
xtn = min(xt) : 90 : max(xt);
set(gca, 'Xtick',xtn, 'XTickLabel',ceil(rem(xtn,360.1)))
xlim([min(contAngle) max(contAngle)])
8 comentarios
Star Strider
el 26 de En. de 2019
From the documentation on islocalmax:
‘Minimum separation between local maxima, specified as the comma-separated pair consisting of 'MinSeparation' and a nonnegative scalar. ’
Another option is the ischange (link) function. That might be more applicalbe to what you want to do.
Please understand that without a representative sample of your data, I cannot specifically answer your questions. I can only suggest solutions, not knowing if they are appropriate.
Más respuestas (0)
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!