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