Challenge Solution 1 - hold off %---------- OR...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
SOLUTION: CHALLENGE QUESTION 1 x = 0:0.1:5*pi; hold on plot(x,5*sin(x)) y = 5*sin(x) - ((5*sin(x) - 3).*(5*sin(x) > 3)) - ((5*sin(x) + 3).*(5*sin(x) < -3)); plot(x,y,'c-')
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: hold off %---------- OR &gt;&gt; x= linspace(0, 5*pi, 200); &gt;&gt; y=5*sin(x); &gt;&gt; y(~(y&lt;=3)|~(y&gt;=-3))=y(~(y&lt;=3)|~(y&gt;=-3)).*abs(3./y(~(y&lt;=3)|~(y&gt;=-3))); &gt;&gt; plot(x,y)...
View Full Document

Ask a homework question - tutors are online