Can someone write me a code for matlab. Here is what I need it to do. So startin
ID: 3659452 • Letter: C
Question
Can someone write me a code for matlab. Here is what I need it to do. So starting from point C on a row vector, I need it to scan the value at C, and if that value is above 900, create a value of 1 in a new vector. If that value is lower than -900, create a 0 in that new vector Now, move forward 50 units. So now i'm at C+50. I need it to do the exact same thing. Scan the value, if it's above 900, add a 1 to that new vector, if it's below -900 add a 0 to that new vector. I need it to keep doing this until it reaches C+2000 So the new vector would look something like (0, 1, 1, 1, 0, etc).Explanation / Answer
Assuming r is the row vector and C is the starting point CODE : % new vector d = 0 for k = c:50:c+2000 if (r(k)==600) u = [u 1]; else if (r(k)==-600) u = [u 0]; end end end % removing first entry which was due to initialization u = u(2:length(u));
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.