Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MASK modulation problem (HELP!)

Status
Not open for further replies.

arashams

Newbie level 1
Newbie level 1
Joined
May 28, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,286
i want to implement MASK and other modulations using matlab
you can see the equation for doing this
Untitled.png
and this is the guide table
scan0001.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:

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top