how to convolute 2 signals and generate the pulse train from half cycle sine wave?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
clc;
clear all;
close all;
%wt = 0:0.2:pi;
tp=2.2676*10^-3;
Ts=22.67*10^-6;
n=1:Ts:101;
fp=(1/tp);
w=2*pi*fp;
%p=sin(wt);
p=sin(w*n*Ts);
p(find(p<0))=0;
plot(n,p);
data = randi([0,1],1,101);
for k=1:2:100
if data(k)==0 && data(k+1)==0
a(k)=1;
elseif data(k)==0 && data(k+1)==1
a(k)=i;
elseif data(k)==1 && data(k+1)==0
a(k)=-1;
elseif data(k)==1 && data(k+1)==1
a(k)=-i;
end
end
y_s=[];
% syms k
y_s=conv(a,p);
plot(n,y_s);
Im trying the convolution but getting error!! can anyone help?
expexted output

0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Transforms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!