Hello
I have a problem in matlab where i have first modulated the signal and now want to get back to the original square wave form..
I try to use if statements but its not working and it only gives one constant horizontal line.
I have attached the graphs..
What i want it to do is to >>
If we have 0 in figure 12 (M8 ), then the output (M9 ) should be 1, and if do not have 0, then the output should be 1.. hence producing a square waves..
I commented out the problematic part and replaced it with a by-component loop. From what I understand from your problem this might give you what you were looking for.
Hope that helps.
Code:
%if M8 == 0
% M9 = xor(1,M8)*a;
% else
% M9 = 0*a;
%end;
for k=1:1000
if (M8(k) == 0)
M9(k) = a(k);
else
M9(k)=0;
end
end
figure(13),plot(tn,M9);
PS: Note that I ditched the xor, since that always evaluates to 1 anyway at that branch of the if statement.