how to convolute 2 signals and generate the pulse train from half cycle sine wave?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Transforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!