MATLAB Answers

BANI tita

i have problem in matlab

Asked by BANI tita
on 21 Jan 2013

i programmed one program for processing signal but i don't arrive to result please you can correct for me this problem:

n= 1481;
d = pow2(nextpow2(L));
f = (0:d-1)*(Fs/d);
for Ap=0.5
    for i=1:3

thank you



No products are associated with this question.

3 Answers

Answer by Walter Roberson
on 21 Jan 2013

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.


Answer by Image Analyst
on 21 Jan 2013

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.


Answer by BANI tita
on 21 Jan 2013

for Ap take 2 values 0.5 and 1, but in every value Ap, A take 4 values i want to find spectrum graphics, but in this program i find principal spectrum and spectrum of A=0.12 and for A=0.036. thank you


Please re-state the question, and the problem you are observing. What error message are you seeing, at what line?

i have program of frequency modulation, but the modulated signal is sum of 4 signals of amplitude variant and frequency too. my function is:


with AP=0.5 & 1

m takes 1,2,3 and 4

Am takes 0.12, 0.059, 0.053 and 0.036 depending of m.

program that i was doing is in 1st conversion for Ap=0.5, problem that i'm finding is when execute program i find 3 spectrums : principal and for m=1 and m=4. normally i must find all spectrum

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?

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!