微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微波和射频技术 > 电磁仿真讨论 > MASK modulation problem (HELP!)

MASK modulation problem (HELP!)

时间:03-30 整理:3721RD 点击:
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

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

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top