how to convolute 2 signals and generate the pulse train from half cycle sine wave?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Transforms dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!