selfguided

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

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

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

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

View Full Document
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:
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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online