selfguided - Write a MATLAB program called practiceFnc1 for...

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

View Full Document Right Arrow Icon
Write a MATLAB program called practiceFnc1 for the following mathematical function: Assume that this function can be Used to calculate the value of f ( x ) at a single point Used to plot f ( x ) using the plot command Use basic programming conventions for readability. function y = practiceFnc1(x) % This function translates the function for equation 1 to MATLAB. % 24 January 2009, J. Daida numerator = x; denominator = x.^2 + 1; y = numerator ./ denominator; In this program, I’ve also separated out the numerator and the denominator into separate lines. For a small program like this, it wasn’t essential to do. Note the use of the .^ and the ./ operators. Write a MATLAB program called practiceFnc2 for the following mathematical function: Assume that this function can be Used to calculate the value of f ( x ) at a single point Used to plot f ( x ) using the plot command Use basic programming conventions for readability function y = practiceFnc2(x) % This function translates the function for equation 1 to MATLAB. % 24 January 2009, J. Daida
Background image of page 1

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

View Full DocumentRight Arrow Icon
numerator = 3*(x.^2) - 2; denominator = 5*(x.^2) + 2*x + 3; y = numerator ./ denominator; Write a MATLAB program called practiceFnc3 for the following mathematical function: Assume that this function can be Used to calculate the value of f ( x ) at a single point Used to plot f ( x ) using the plot command Use basic programming conventions for readability. function y = practiceFnc3(x) % This function translates the function for equation 3 to MATLAB. % 24 January 2009, J. Daida y = x - sqrt(x.^2 + 2); Write a MATLAB program called practiceFnc4 for the following mathematical function: Assume that this function can be Used to calculate the value of f ( x ) at a single point Used to plot f ( x ) using the plot command Use basic programming conventions for readability. function y = practiceFnc4(x) % This function translates the function for equation 4 to MATLAB. % 24 January 2009, J. Daida y = x - sqrt(x.^2 - 2.*x); Write a MATLAB program called practiceFnc5 for the following mathematical function:
Background image of page 2
Assume that this function can be Used to calculate the value of f ( x ) at a single point Used to plot f ( x ) using the plot command Use basic programming conventions for readability. function y = practiceFnc5(x) % This function translates the function for equation 5 to MATLAB. % 24 January 2009, J. Daida numerator = 1; denominator = 1 + x; y = numerator ./ denominator; Write a MATLAB command that would express the following equation: Use ONLY the MATLAB programs that were written in Questions 1 - 5. In other words, at a MATLAB Command Window prompt, compute for g ( x ) using only practiceFnc1 , practiceFnc2 , practiceFnc3 , practiceFnc4 , and practiceFnc5 . Assume that
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 13

selfguided - Write a MATLAB program called practiceFnc1 for...

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

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