MASK modulation problem (HELP!)

Status
Not open for further replies.

arashams

Newbie level 1
Joined
May 28, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,286
i want to implement MASK and other modulations using matlab
you can see the equation for doing this

and this is the guide table

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:

Hi

I did not simulate your code. But it seems that 'teta' variable should have value either 0 or 1. You can use teta=randint(1,96); and see if you get your desired waveform.

MHanif
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…