From: TideMan on
On May 27, 5:56 pm, "Abdullah " <zabdull...(a)hotmail.com> wrote:
> hi ,
> Strange!!
>
> this time instead of obtaining a spectrum for the signal of 1.5 Mhz and obtaining 3 Mhz even (2 I get 4 MHz) strange!!.
>
> I used the suggested script (Tideman) , please help me ??
>
> clc;
> clear all
> Fo=10e6;
> To=1/Fo;
> t=0:To/50:5*To;
> xt=sin(2*pi*150000000*t);
> L=length(xt);
> figure(1);
> subplot(311);
> plot(t,xt,'r');grid;
> xlabel('Cosine Signal xt = cos(4000*pi*t)');
>
> figure(2)
>
> N = 2^nextpow2(L); % Next power of 2 from length of vdata
> X = fft(xt,N);
> M =abs(X(2:N/2));
> f=(1:N/2-1)*Fo/N;
>
> plot(f,M);
>
> Regards and Thanks

There's nothing strange about it.
I've already told you where you're wrong (Point 3), but you haven't
taken a blind bit of notice, you're continuing to use the freq of the
sine wave, not the sampling freq. I don't have the patience to deal
with people who ignore advice and continue to do the wrong thing, then
complain that things are strange.

Also, you don't need to use dyadic numbers for the Matlab FFT, so you
can omit this line and just use L:
N = 2^nextpow2(L); % Next power of 2 from length of vdata
From: Omer on
On May 27, 10:56 am, "Abdullah " <zabdull...(a)hotmail.com> wrote:
> hi ,
> Strange!!
>
> this time instead of obtaining a spectrum for the signal of 1.5 Mhz and obtaining 3 Mhz even (2 I get 4 MHz) strange!!.
>
> I used the suggested script (Tideman) , please help me ??
>
> clc;
> clear all
> Fo=10e6;
> To=1/Fo;

> t=0:To/50:5*To;
** This corresponds that your sampling frequency is 50*Fo = 500MHz

> xt=sin(2*pi*150000000*t);
** This is not 1.5 MHz rather it is 150 MHz

> L=length(xt);
> figure(1);
> subplot(311);
> plot(t,xt,'r');grid;

> xlabel('Cosine Signal xt = cos(4000*pi*t)');
** Strange Label

>
> figure(2)
>
> N = 2^nextpow2(L); % Next power of 2 from length of vdata
> X = fft(xt,N);
> M =abs(X(2:N/2));

> f=(1:N/2-1)*Fo/N;
** Use correct sampling frequency which is 500MHz in this case and all
your problems will be solved.

>
> plot(f,M);
>
> Regards and Thanks

From: Abdullah on
Thank you very much "Tideman"

You know the problem was with this formular t=0:To/50:5*To; it changes the parameters that I put for Fo and frequency of sin signal. I did not realize that until Omer confirms that.

Regards & thanks,
From: Abdullah on
Omer <omer.rajput(a)gmail.com> wrote in message <e735faa3-8e29-4868-9457-d2eac31f9903(a)q36g2000prg.googlegroups.com>...
> On May 27, 10:56 am, "Abdullah " <zabdull...(a)hotmail.com> wrote:
> > hi ,
> > Strange!!
> >
> > this time instead of obtaining a spectrum for the signal of 1.5 Mhz and obtaining 3 Mhz even (2 I get 4 MHz) strange!!.
> >
> > I used the suggested script (Tideman) , please help me ??
> >
> > clc;
> > clear all
> > Fo=10e6;
> > To=1/Fo;
>
> > t=0:To/50:5*To;
> ** This corresponds that your sampling frequency is 50*Fo = 500MHz
>
> > xt=sin(2*pi*150000000*t);
> ** This is not 1.5 MHz rather it is 150 MHz
>
> > L=length(xt);
> > figure(1);
> > subplot(311);
> > plot(t,xt,'r');grid;
>
> > xlabel('Cosine Signal xt = cos(4000*pi*t)');
> ** Strange Label
>
> >
> > figure(2)
> >
> > N = 2^nextpow2(L); % Next power of 2 from length of vdata
> > X = fft(xt,N);
> > M =abs(X(2:N/2));
>
> > f=(1:N/2-1)*Fo/N;
> ** Use correct sampling frequency which is 500MHz in this case and all
> your problems will be solved.
>
> >
> > plot(f,M);
> >
> > Regards and Thanks
Thank you very much Omer about reply
They are solved!!, as you said.
Regards &thanks
First  |  Prev  | 
Pages: 1 2
Prev: Image Upload in GUI
Next: .mdl to m-file