arashams
Newbie level 1
i want to implement MASK and other modulations using matlab
you can see the equation for doing this
![Untitled.png Untitled.png](https://www.edaboard.com/data/attachments/32/32692-410e4c4bf52eae39ed94f3716ca3717e.jpg)
and this is the guide table
![scan0001.jpg scan0001.jpg](https://www.edaboard.com/data/attachments/32/32693-8742e2df286ea892da31d8b1af21d37c.jpg)
but after all my code is not working and i dont know why!
plz help me
you can see the equation for doing this
![Untitled.png Untitled.png](https://www.edaboard.com/data/attachments/32/32692-410e4c4bf52eae39ed94f3716ca3717e.jpg)
and this is the guide table
![scan0001.jpg scan0001.jpg](https://www.edaboard.com/data/attachments/32/32693-8742e2df286ea892da31d8b1af21d37c.jpg)
but after all my code is not working and i dont know why!
plz help me
Code:
clc
data=get(handles.txt1,'String');
%data=[1 0 1 1 0];
rbt2ASK=get(handles.rb2ASK,'Value');
data=str2num(data);
t=0:2*pi/99:2*pi;
cp=[];sp=[];
mod=[];mod1=[];bit=[];
at=[];
ft=0;
phit=0;
fs=1200000;
fc=150000;
i=[];
teta=[0:95];
i=[1:96];
ft=fc;
phit=0;%phi teta
for n=1:length(data);
if data(n)==0;
die=ones(1,100);
se=zeros(1,100);
else
die=1.5*ones(1,100);
se=ones(1,100);
end
c=(0.8*teta+0.2).*cos(2*pi*ft.*i/fs+phit);% the problem is right here!!! :( i used above equation for 2ASK but this is not working
cp=[cp die];
mod=[mod c];
bit=[bit se];
end
ask=cp.*mod;
axes(handles.axes1)
plot(bit,'LineWidth',1.5);grid on;
axis([0 100*length(data) -2.5 2.5]);
xlabel('Zaman (s)');
ylabel('Damane');
legend('input Signal m(t)');
if rbt2ASK==1
i=[1:96];
ft=fc;
phit=0;
teta=[0:95];
set(handles.txtinfo,'string','2ASK has been selected');
%at=(0.8*teta+0.2).*cos(2*pi*ft.*i/fs+phit);
axes(handles.axes2);
plot(ask,'LineWidth',1.5);grid on;
title('2ASK modulation');
axis([0 100*length(data) -2.5 2.5]);
end
Last edited: