q=readtable('a.txt');
A=q.a;
B=q.b;
C=q.c;
L=length(A);
P=length(B);
S=1;
q.complex=complex(q.d,q.e);
v=reshape(q.complex,L,[]);
X=-10.27:0.1361:10.139;
Y=-10.57:0.1401:10.4366;
v_I=16*ifft2(v.');
v_db=20*log10(v_I);
figure
imagesc(X,Y,v_db.'); grid on
axis equal
axis tight; colormap(hot);
My question is at theory wise v_I(i,j) has to be converted into v_I(e,f) where e=(i^2-j^2)/2*i and f=j and then we have to convert it into a figure. I am not able to this transform.

댓글 수: 5

Benjamin Thompson
Benjamin Thompson 2023년 1월 11일
Please provide more information about what you are trying to do.
riki singh
riki singh 2023년 1월 11일
V_I(e,f) =ifft2 v_i(i,j) where e=(i^2-j^2)/2*i f=j figure imagesc(X,Yv_db.'); grid on axis equal axis tight; colormap(hot);
Image Analyst
Image Analyst 2023년 1월 11일
You need to define Yv_db, just like it says. Also, what variable is your image?
riki singh
riki singh 2023년 1월 11일
I hv edited plz check now..
riki singh
riki singh 2023년 1월 12일
My main aim is once i do this step V_i= 16*ifft2(v.'); I will get as 2D array Next is i have to extract the data and change the values inside v.'matrix into X=u^2 Y=v
And now plot the image wrt v(x,y) which was basically before v(u,v) Just the transformation inside the matrix

댓글을 달려면 로그인하십시오.

답변 (1개)

Abhishek
Abhishek 2025년 8월 18일
편집: Abhishek 2025년 8월 18일

0 개 추천

I understand you're encountering an error when attempting to visualize a 2D complex-valued matrix using `imagesc`. The issue arises from passing complex data to a function that only supports real values.
In your code, you're performing an inverse FFT operation and then directly computing the dB scale with `log10`. You are applying `log10` directly to` v_I`, which is a complex matrix (since `ifft2` of complex data typically remains complex). Taking `log10` of complex values results in complex outputs, which `imagesc()` cannot plot.
To plot magnitude in dB, you should first take the absolute value of ` v_I`. Make the following changes in your code to compute `v_db`:
v_db = 20 * log10(abs(v_I) + eps);
I tried applying the above change, and ran the code with the given input file in MATLAB R2024b, and got the following plot:
Hope it helps.

카테고리

도움말 센터File Exchange에서 Scatter Plots에 대해 자세히 알아보기

태그

질문:

2023년 1월 11일

편집:

2025년 8월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by