i have problem in matlab
조회 수: 1 (최근 30일)
이전 댓글 표시
i programmed one program for processing signal but i don't arrive to result please you can correct for me this problem:
Fs=4000;
n= 1481;
T=1/Fs;
L=4096;
t=(0:L-1)*T;
d = pow2(nextpow2(L));
f = (0:d-1)*(Fs/d);
p=40;
M=4;
A=[0.12;0.059;0.053;0.036];
for Ap=0.5
for i=1:3
s1=A(1,1)*sin(2*pi*1*(n/60)*t);
si=A(i+1,1)*sin(2*pi*(i+1)*(n/60)*t);
s=s1+si;
s;
x1=Ap*sin(2*pi*(n/60)*p*t+s);
y1=fft(x1,d)/L;
end
end
thank you
댓글 수: 0
답변 (3개)
Walter Roberson
2013년 1월 21일
No, we cannot correct it for you, as you have not indicated what you do expect and you have not indicated what problems you observe. The code you show is perfect for achieving whatever it achieves right now, and we have no reason to know that what it does now is not exactly what it should be doing.
댓글 수: 0
Image Analyst
2013년 1월 21일
Ap is in a for loop but it never takes on any values except 0.5, you're indexing A as if it's a 2D array when it's really just a 1D array, and you overwrite x1 and y1 every iteration. Those are some unusual looking things, but other than that, we don't know what you're expecting because you didn't tell us.
댓글 수: 0
BANI tita
2013년 1월 21일
댓글 수: 5
Walter Roberson
2013년 1월 21일
Your "for i" loop only goes to 3, so I am not surprised you got 3 of something. How many spectrum are you expecting?
I note that your code overwrites x1 and y1 in ever iteration of the "for i" loop; is there a reason you are computing the values and throwing them away in the next iteration of the loop?
참고 항목
카테고리
Help Center 및 File Exchange에서 Modulation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!