Ask your own question, for FREE!
Mathematics 17 Online
OpenStudy (anonymous):

MATLAB project. Can someone help me finish the code?

OpenStudy (anonymous):

OpenStudy (anonymous):

May be you did already: did you try placing this in the computer section of Open Study? I know a little bit of 'C' but nothing this advanced, may I ask what course or what level course this is?

OpenStudy (anonymous):

This is for matlab. It's similar to C, but not C.

OpenStudy (espex):

What have you done so far?

OpenStudy (anonymous):

There is the code at the end in the word doc.

OpenStudy (espex):

Ah, I see it now.

OpenStudy (anonymous):

So I have to continue writing a code that would find where the "tone" ends, and then save the whole "pulse"

OpenStudy (anonymous):

And then analyze the binary part.

OpenStudy (espex):

You can put it into an if statement to catch the tone and then a while loop to catch the next 10.25 seconds

OpenStudy (espex):

Once you have the signal you can skip the next 18 seconds worth and grab the binary data.

OpenStudy (anonymous):

Well, I understand what I have to do, but I have trouble writing the code.

OpenStudy (anonymous):

Like how would I write for the code to select the pulse data?

OpenStudy (anonymous):

Does any of this make sense?

OpenStudy (espex):

Yes, and I am trying to decide how you would formulate that. You have 1 sample of data coming in ever 1/50 of a second, so while the condition is true you want to loop for 10.25 seconds and capture each sample into your vector.

OpenStudy (anonymous):

@mahmit2012

OpenStudy (espex):

Presumably you are going to put this whole thing inside a loop so that it iterates through every piece of data. Create a vector array that is 513 spaces long to hold your calibration signal (50*10.25) and you sample each piece of data if (find(f>20 & f<22)) i=0; do cal_vec[i]=f; i++ while(f>20 & f<22);

OpenStudy (espex):

Compare your value of i after your loop and see if it is equal to the 512 bits of data you were expecting. If it isn't then you do not have your carrier signal.

OpenStudy (anonymous):

ok

OpenStudy (anonymous):

And for the last part then, how would I get it to iterate every 1 second to select the wave it needs. like for the binary signal portion.

OpenStudy (espex):

You will have already loaded your signal into your program, through a matrix or vector, you use a loop to control how far you step through any particular piece of data. Once you have figured out where you want to be, you step through the expected number of pieces, like you will do with the calibration signal.

OpenStudy (anonymous):

Okay, Say I have the file stored "pulse signal", I want to just go ahead 18 seconds from the end of the tone signal to the start of the binary signal. And then iterate every 1 second from there. So pretty much, as soon as the tone signal has ended, I skip over the pulse signal and go straight to iterating the binary signal. So once I get to the binary signal, I analyze it 1 second at a time, since each wave is exactly 1 second apart.

OpenStudy (espex):

Since I do not recall that there were streams in matlab (perhaps above my pay grade) I would say that you are most likely going to read the entire sample into a vector at one time. You will then step through that vector using the index like you would with any array. You will have to keep track of where you are in it, but you can just take your current iteration and add 900 (18*50) to jump 18 seconds worth. Or you might just create a loop to read 'x' number of seconds worth of data into matlab and analyze that. It will really depend on how you are handling the sample you're given.

OpenStudy (anonymous):

Alright. Thank you for the help.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!