Info

This question is closed. Reopen it to edit or answer.

code is giving an empty matrix

1 view (last 30 days)
Naema
Naema on 14 Mar 2014
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi: I am having an empty figure as the result, can anyone see what is the problem?. thanks,
here is the code//////////////// clear all; close all; clc; x=-120:1:120-1; y=-120:1:120-1; [X,Y]=meshgrid(x,y); rf=(2250/2); aaa = (-120:1:120); bbb = (-120:1:120); % for xx=linspace(-120,120,240); a=1; for xx=-120:1:120; b=1; for yy=-120:1:120;
% for yy=linspace(-120,120,240); C=zeros(length(X),length(Y)); Eyspp=dlmread('jamal_6_2.txt');
Eyfib=exp((-(X-xx).^2-(Y-yy).^2)/rf^2); % fib=Eyfib(b:b+xx-1,a:a+yy-1); fn_int=Eyfib.*conj(Eyfib); % Norma = sum(sum(Eyspp.*conj(Eyspp)))*sum(sum(Eyspp.*conj(Eyspp))); % C(a,b)=sum(sum(fn_int)./sqrt(Norma)); C(a,b)=sum(sum(fn_int)); b=b+1; end a=a+1; end figure(1); imagesc(aaa,bbb,abs(C));title('overalp');xlabel('um') axis square; grid on;
# Item one # Item two

Answers (2)

Naema
Naema on 14 Mar 2014
the code is organized here, is there anyone who could help me figure out what is wrong with the code? thanks, Naema
clear all;
close all;
clc;
x=-120:1:120-1;
y=-120:1:120-1;
[X,Y]=meshgrid(x,y);
rf=(2250/2);
aaa = (-120:1:120);
bbb = (-120:1:120);
% for xx=linspace(-120,120,240);
a=1;
for xx=-120:1:120;
b=1;
for yy=-120:1:120;
% for yy=linspace(-120,120,240);
C=zeros(length(X),length(Y));
Eyspp=dlmread('jamal_6_2.txt');
Eyfib=exp((-(X-xx).^2-(Y-yy).^2)/rf^2);
% fib=Eyfib(b:b+xx-1,a:a+yy-1);
fn_int=Eyfib.*conj(Eyfib);
% Norma = sum(sum(Eyspp.*conj(Eyspp)))*sum(sum(Eyspp.*conj(Eyspp)));
% C(a,b)=sum(sum(fn_int)./sqrt(Norma));
C(a,b)=sum(sum(fn_int));
b=b+1;
end
a=a+1;
end
figure(1);
imagesc(aaa,bbb,abs(C));title('overalp');xlabel('um')
axis square; grid on;

Naema
Naema on 14 Mar 2014
the data file that is needed to run the code is attached (jamal_240) which is named Eyspp in the code.

This question is closed.

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!