Question

Matlab for engineers 5th edition please help me with this problem with explanation. Consider the following...

Matlab for engineers 5th edition

please help me with this problem with explanation.

Consider the following mathematical expression to create a single input-output function.

y= −x​3+ x​2 + 2

a)Create a single input-output function that can accept scalar and matrix values.

b)Plot the output versus the input, and properly label the axes and add a title. Note: the plot command should be coded inside the function file.

c)Calculate y values for x= [−10, 10] with an appropriate increment.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

function y=expression(x)
y=-x.^3+x.^2+2;%calculates value of y on input xa
plot(x,y)%plots the value of y versus x
xlabel('Input value')
ylabel('Output value')
title('y=-x^3+x^2+2')

Command Window ー ロ × Editor. CAUsers EDITOR PUBLISH >> %to get function value for x--10 to 10, and plotting them, pass a vect%%TYPE IN COMMAND WINDOW

x=-10:.1:10;
y=expression(x);

Add a comment
Know the answer?
Add Answer to:
Matlab for engineers 5th edition please help me with this problem with explanation. Consider the following...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using Matlab; Please show written program to execute and instructions to create plot: 1. Create a...

    Using Matlab; Please show written program to execute and instructions to create plot: 1. Create a vector of x values from 0 to 20 pi, with an increment of pi/100. y=x sin (x) and z= x cos (x) a) create a figure window with two subplots. In first subplot create an x versus y plot and in the second subplot create an y versus z plot. b) create a polar plot of x and y. Add title and labels to...

  • please do this problem in matlab and show me the code. Thanks. please do this problem...

    please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks.please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me...

  • please do this problem in matlab and show me the code. Thanks. please do this problem...

    please do this problem in matlab and show me the code. Thanks. please do this problem in Matlab and show me the code. Thanks. Problem #1: Circuits and linear-systems In the last HW you developed the governing equations for the “Wheatstone”-bridge circuit used extensively in engineering applications (shown below). B R R2 A D G m RA с E The resulting equations were solved for the output voltage and currents using the function: function [V_out, I_vector] =Wheatstone_bridge (v_in, R_vector) In...

  • Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture...

    Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture i sent is the first page 5. Write and save a function Sphere Area that accepts Radius as input argument, and returns SurfaceArea (4 tt r) as output argument. Paste the function code below. Paste code here 6. Validate your Sphere Area function from the command line, checking the results against hand calculations. Paste the command line code and results below. 7. Design an...

  • MATLAB Problem HW7P2 (20 points) (5 pts) Write a user-defined MATLAB function called HW7P2_fn for the...

    MATLAB Problem HW7P2 (20 points) (5 pts) Write a user-defined MATLAB function called HW7P2_fn for the following math function 3 o-0.47x The input to the function is x and the output is y. Write the function such that x can be an array (use element-by-element operations) (15 pts) Use the function in (a) the command window to calculate y(-2) and y(5) (b) a script file HW7P2.m to determine y(x) for 0.001 Sx S 10 with 1000 points. Hint: Use the...

  • Please help me with this MATLAB programming problem! Im coding iin MATLAB2018 if that makes any d...

    Please help me with this MATLAB programming problem! Im coding iin MATLAB2018 if that makes any difference! The first picture is the question i need to answer. The picture below is used as reference to answer the question. The last picture (below) is the into to the problem, and is used as reference. 1. Use Matlab to create the following single plot with three subplots. All titles, gridlines, and axis labels should be as shown. Arc System Response 15 E...

  • Question 1: Creating a user-defined function Write a user-defined MATLAB function named PBTask4pl_f.m for the following...

    Question 1: Creating a user-defined function Write a user-defined MATLAB function named PBTask4pl_f.m for the following math function with x the input argument and y the output y(x)=0.8x4-13x2-5x The function should work for x being a scalar or a vector. Write a script file named PBTask4pl.m to a) Use the function to calculate y(3) and y(5) and display the results in command window b) Use the function to make a plot of the function y(x) for -5:5: x 5:5. Label...

  • Please help with this MATLAB problem! I'm writing in MATLAB_R2018b if that makes a difference:) 7....

    Please help with this MATLAB problem! I'm writing in MATLAB_R2018b if that makes a difference:) 7. Write a Matlab function (HW07 07.m) that takes 4 arguments and returns two arrays. The arguments are the Xc and yc coordinates of the center of a circle, the radius r of the circle, and the number of points n on the circle. The function should create a list of n equally-spaced angle values ranging from 0 to 2n. Then, for each angle value,...

  • MATLAB question! PLEASE HELP Create a function that returns true if the input is a scalar...

    MATLAB question! PLEASE HELP Create a function that returns true if the input is a scalar value (i.e. of size 1x1) of class type double and false otherwise. • Function Name: isScalar • Input: single input which may be any data class • Output: the output is true or false • Useful functions: size(), class(), strncmp()

  • please write code in MATLAB as well 5. (12 points) Create the following signal in Matlab:...

    please write code in MATLAB as well 5. (12 points) Create the following signal in Matlab: x[n] = u(n) - u[n-6] a. Mathematically compute yi[n] = x[n] * x[n] where * means convolution. Now use the conv command to perform the convolution. Graph x[n) and the resulting y(n), both over the interval Osns 20. How many non-zero terms does y(n) have? Does your computational result agree with the Matlab result? b. Repeat a. but this time with yz[n] = x[n]*h[n)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT