필터 지우기
필터 지우기

error in multiply a square wave and Fresnel function and plotting it...

조회 수: 1 (최근 30일)
TULIKA
TULIKA 2015년 2월 27일
답변: Geoff Hayes 2015년 3월 1일
[X,Y] = meshgrid(-2:.2:2);lambda=.000000001;z=.000010;R =X.^2;
F = exp((i.*pi.*R)./(lambda.*z));
mesh(imag(F));
l=20e-6;
w=4e-6;
Ts=1e-9;
t1=0:Ts:w;
t0=w+Ts:Ts:l-Ts;
s1=ones(size(t1));
s0=zeros(size(t0));
s=[s1 s0];
N=7; %How many repetitions of the wave
ss=repmat(s,1,N);
t=0:Ts:N*l-Ts;
plot(t,ss)
ss=imresize(F,[21 21]);
az=ss.*F;
plot(t,az)

채택된 답변

Geoff Hayes
Geoff Hayes 2015년 3월 1일
Tulika - why not include the error message? If I try to run the above code, I observe
Error using plot
Vectors must be the same lengths.
This is because your t is a 1x140000 array of doubles whereas az is a 21x21 array of complex numbers. Since they are of different dimensions, then the error message makes sense.
Step through the code to observe the same, and consider what is happening at each line and whether it makes sense.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by