Why i am not getting my message signal as output ?

2 views (last 30 days)
This is my code for Am demodulation.I am not getting my signal "y" as output.why i am not getting ?
clear all;
clc;
Fs = 6000;
fc=1000;
f_del=100;
fm=500;
t1=0:1/Fs:1-1/Fs;
Am=2;
Ac=5;
x1=cos(2*pi*(fc+f_del)*t1);
y=cos(2*pi*fm*t1);
z1=x.*y;
a1=z1.*x1*Ac;
y3=cos(2*pi*f_del*t1);
lpFilt = designfilt('lowpassfir', 'PassbandFrequency', 0.1667,...
'StopbandFrequency', 0.2167, 'PassbandRipple', 0.02, ...
'StopbandAttenuation', 85, 'DesignMethod', 'kaiserwin');
dataout1=filter(lpFilt,a1);
DCB=dsp.DCBlocker('Algorithm','FIR','Length', 100);
demodout1=step(DCB,dataout1'); %% demodout1= y.*cos(2*pi*f_del*t)=y.*y3
demodout2=(demodout1)'./y3;
output should be "y" but not coming...
  2 Comments
Ankit
Ankit on 25 Nov 2019
Line 12: x is not defined. Is it x1 or x?
z1=x.*y;
per isakson
per isakson on 25 Nov 2019
I got the error
Undefined function or variable 'x'.
Error in cssm (line 12)
z1=x.*y;
then I replaced x by x1 in line 12 and the code run happily to the end
>> whos y x1
Name Size Bytes Class Attributes
x1 1x6000 48000 double
y 1x6000 48000 double
The variable y was defined

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!