Signal Spectrum MATLAB Syntax -


i have little problem regarding matlab , syntaxes. i'm trying plot spectrum regarding am-modulated signal.

in case am-modulation defined as:

y(t)=[1+m*x(t)]*cos(2*pi*fc*t), fc=100 khz , m=0.5

breaking y(t) in parts:

y(t)=cos(2*pi*fc*t)+m*x(t)*cos(2*pi*fc*t) 

and x(t) cosine wave amplitude of 1 , frequency range fx=[0-5000hz]. y(t) can written as:

y(t)=cos(2*pi*fc*t)+m*cos(2*pi*fx*t)*cos(2*pi*fc*t) 

using trigonometric identity, can write y(t) as:

cos(x)cos(y)=1/2(cos(x-y)+cos(x+y))  y(t)=cos(2*pi*fc*t)+m/2*cos(2*pi*t(fc-fx))+m/2*cos(2*pi*t(fc+fx)) 

now when fx=[0,5000hz], y(t) can written sum of these harmonic waves:

y(t)=cos(2*pi*fc*t)+m/2*cos(2*pi*t(fc-0))+m/2*cos(2*pi*t(fc+0))+m/2*cos(2*pi*t(fc-1))+m/2*cos(2*pi*t(fc+1))... + m/2*cos(2*pi*t(fc-5000))+m/2*cos(2*pi*t(fc+5000)) 

now when writing down in matlab:

clear all; fc=100000; //base frequency fs=250000; //sampling rate should fs>2fc according nyquist criterion ts=1/fs; m=0.5; t = 0:ts:1-ts; fx= 0:1:5000; yt=cos(2*pi*fc*t)+m*0.5*cos(2*pi*t(fc-fx))+m*0.5*cos(2*pi*t(fc+fx)) // goes wrong plot(abs(fft(yt))); // don't know if correct way plot it. 

the program states there's error in line yt, complains matrix dimensions should agree. don't know how can fix prom, or suggestions appreciated.

the reason why because dimensions of t , dimensions of fx don't match. need make sure both of dimensions of t , fx match. therefore, try changing fx ensure both arrays same size:

fx = 0:(numel(t)-1); 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -