Borrar filtros
Borrar filtros

How can I make a 3d

7 visualizaciones (últimos 30 días)
David
David el 25 de Jun. de 2022
Comentada: Star Strider el 26 de Jun. de 2022
Hello everyone, I have had problems when making a 3d plot for different rectangular pulses, in the 'y' axis the amplitude should go in voltage, in the 'x' axis the time, finally in the z axis the samples. I have searched for information but have not been able to find a good source.

Respuestas (1)

Star Strider
Star Strider el 25 de Jun. de 2022
There are several ways to do that. One is to use the plot3 funciton, another is the waterfall function.
t = linspace(0,5);
s = sin((1:6).'*2*pi*t/5);
figure
hold on
for k = 1:size(s,1)
plot3(t, ones(size(t))*5*k, s(k,:))
end
hold off
grid on
view(50,50)
Experiment with your own data.
.
  9 comentarios
David
David el 26 de Jun. de 2022
I am using exactly the same code:
t = linspace(0,5);
s = sin((1:6).'*2*pi*t/5);
Timem = cat(2,Time1,Time2,Time3,Time4); % Concatenate To Matrix
Voltajem = cat(2, Voltaje1,Voltaje2,Voltaje3,Voltaje4); % Concatenate To Matrix
figure
hold on
for k = 1:size(s,1)
plot3(Timem(:,k), ones(size(Timem,1))*k, Voltajem(:,k))
end
hold off
grid on
xlabel('Time (ns)')
ylabel('Sample')
zlabel('Ampliitude (a.u.)')
view(50,50)
Star Strider
Star Strider el 26 de Jun. de 2022
That demonstration code is not appropriate for your data.
Use this instead:
Timem = cat(2,Time1,Time2,Time3,Time4); % Concatenate To Matrix
Voltajem = cat(2, Voltaje1,Voltaje2,Voltaje3,Voltaje4); % Concatenate To Matrix
figure
hold on
for k = 1:size(s,1)
plot3(Timem(:,k), ones(size(Timem,1))*k, Voltajem(:,k))
end
hold off
grid on
xlabel('Time (ns)')
ylabel('Sample')
zlabel('Ampliitude (a.u.)')
view(50,50)
.

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by