Borrar filtros
Borrar filtros

visualise fft plot in 3D

60 visualizaciones (últimos 30 días)
Athira Surendran
Athira Surendran el 4 de Abr. de 2017
Hi,
I want to plot all the fft plots in a single figure. something like the attached image
Here's my code
for i=1:m
[f(i,:) mag(i,:)]=fftplot(2000000,corr_amp(i,:));
subplot(3,4,i)
plot(f(i,:),mag(i,:))
axis([25000,85000,0,1.1]);
strtime = ['Frequency Spectrum at \delta=', num2str(load(1,i)),'\mum'];
title(strtime,'fontsize',10)
xlabel('Frequency (Hz)')
ylabel('Magnitude')
grid on
grid minor
end;
this code gives me all fft plots as separate plots in a single figure, but i want to arrange all the fft plots in 3D (third axes is 'load' variable in the .mat file attached) as shown in image to see the variation accurately.

Respuesta aceptada

Star Strider
Star Strider el 4 de Abr. de 2017
Use the ribbon (link) plot.
The Code
d = load('Athira Surendran sjs1.mat');
amp = d.amp'; % Amplitude (Transposed)
load = d.load; % Load
t = d.t; % Time
Ts = mean(diff(t)); % Sampling Interval
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
L = length(t);
FTamp = fft(amp)/L; % Fourier Transform
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
figure(1)
hr = ribbon(Fv, abs(FTamp(Iv,:))*2, 0.1);
grid on
for k1 = 1:length(hr)
set(hr(k1), 'FaceColor','b', 'EdgeColor','b')
xpos = get(hr(k1), 'XData');
xtix(k1) = mean(xpos(1,:));
end
set(gca, 'XTick',xtix, 'XTickLabel',load)
xlabel('Load')
ylabel('Frequency (Hz)')
zlabel('Amplitude')
view([135, 30])
I believe that I chose the correct variables. If not, changing my code to use the correct ones is straightforward.
The Plot
  1 comentario
agung pratama
agung pratama el 15 de Ag. de 2020
Editada: agung pratama el 15 de Ag. de 2020
Can i transform a 3D surface that x,y,z axis in pixel into mm?

Iniciar sesión para comentar.

Más respuestas (1)

KSSV
KSSV el 4 de Abr. de 2017
You may follow something like this:
x = linspace(0,2*pi) ;
N = 10 ;
pos = 1:N ;
figure
hold on
for i = 1:N
z = i*sin(x) ;
y = repmat(pos(i),size(x)) ;
plot3(x,y,z,'r');
end
view(3)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by