Homework 4 - yValues = [1:100:60000]; %array of y values to...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
BMED 2200 Modeling Biomedical Systems I Spring 2008 Homework 4 Solution Eric’s Solution % Array of y values to input into t(y) yValues = [0:100:60000]; % t(y) results tValues = []; % Iterate through each y value, compute t(y), and store the result in % tValues for y = yValues if y <= 10000 tValues = [tValues, 200]; % Append 200 to t tValues = [tValues, 200 + 0.1 * (y - 10000)]; tValues = [tValues, 1200 + 0.15 * (y - 20000)]; else tValues = [tValues, 5700 + .25 * (y - 50000)]; end end plot(yValues, tValues); title( 'Homework 2.6' ); xlabel( 'y' ); ylabel( 't' ); Kyle’s Solution % Altered problem 2.6 out of the book y = input('Give the value of y = '); %prompts for the value of y
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: yValues = [1:100:60000]; %array of y values to graph over t = ; %initiates the t array as blank t_result = equation_2_6(y) %calculates a single output for y as the input using a seperate function %iterates through the y values and stores the results in the array t which %will be graphed for y = yValues if y &lt;= 10000 t = [t, 200]; %appends 200 to the end of the t array elseif ((y &gt; 10000) &amp;&amp; (y &lt;= 20000)) t = [t, 200 + .1 * (y - 10000)]; elseif ((y &gt; 20000) &amp;&amp; (y &lt;= 50000)) t = [t, 1200 + .15 * (y - 20000)]; elseif y &gt; 50000 t = [t, 5700 + .25 * (y - 50000)]; end end %plots the piecewise function on figure 1 plot(yValues, t) title('Homework 4') xlabel('x') ylabel('y')...
View Full Document

Page1 / 2

Homework 4 - yValues = [1:100:60000]; %array of y values to...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online