MATLAB Answers

Plotting results of fft2 with frequencies in the x and y axes

2 views (last 30 days)
savitha muthanna
savitha muthanna on 8 May 2021
I have the results of the position and momenta of particles, in the matrix y1, from (1:N,1:N) for positions and (1:N,N:2N) of momentum. IT represents time.
for IT=1:(t/L),
yq(IT, 1:N,1:N)=y1(IT,1:N,1:N);
yp(IT, 1:N,1:N)=y1(IT,1:N, N+1,2*N);
YP=fft2(yp(IT, :,:));
I took fft2 to compute the spectrum for the positions and momenta and now I want to plot them. I tried the following,:
sYQ(IT,:,:)=rYQ(IT,:,:) ./ max(rYQ(IT,:,:));
Is the above correct? In addition, I get an error saying :
Error using surf (line 71)
Z must be a matrix, not a scalar or vector.
Please help.

Answers (1)

VBBV on 8 May 2021
%if true
savitha muthanna
savitha muthanna on 9 May 2021
I dont want to plot yq or yp and they are unrelated. I found that if I permute the order such that IT is the third dimension, the surf in my code works.

Sign in to comment.


Community Treasure Hunt

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

Start Hunting!