Info

此问题已关闭。 请重新打开它进行编辑或回答。

code is giving an empty matrix

1 次查看(过去 30 天)
Naema
Naema 2014-3-14
关闭: MATLAB Answer Bot 2021-8-20
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

回答(2 个)

Naema
Naema 2014-3-14
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 2014-3-14
the data file that is needed to run the code is attached (jamal_240) which is named Eyspp in the code.

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by