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.

Matlab simple problem!

Status
Not open for further replies.

Girly_girl

Full Member level 2
Full Member level 2
Joined
Oct 14, 2009
Messages
143
Helped
9
Reputation
18
Reaction score
8
Trophy points
1,298
Location
UK
Activity points
2,125
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..

if M8 == 0
M9 = xor(1,M8 )*;
else
M9 = 0*;
end;
 
Last edited:

Shouldn't you be doing this on a by component base?

I can see how you get all zeroes, since as far as I can tell essentially you do

if (something_that_always_evaluates_to_false)
never_happens
else
answer_du_jour=0*;


Could be I am missing something though. (such as full code to make spotting the error easier. ;-) )

Apart from that, since you're using XOR anyway, why not XOR the modulated vector with the modulation vector by component, and see how that goes?
 
Thanks for ur response..

Please find attached
 
Last edited:

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.
 
Wow excellent job... Thanks
BTW i love ur display pic lol
Thanks again
 

Oh, go on! I bet you say that to all the hand puppets with pulsating red eyes!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top