User-defined function, MATLAB Programming

Assignment Help:

Your functions will allow you to create the following graph, which contains a piecewise function where a line exists in the first interval, a parabola in the second interval, and the sine function in the third interval. Notice that where each interval meets, points with an ‘o' marker are located. Each one of the 4 functions you create will plot something on a single figure.

Create a function called cs151f11assn5first. The purpose of this function is to plot the line of the first interval. This function has four input arguments (in this order): 

the x and y coordinates of a point on the line (matrix of two values: x and y)

the x and y coordinates of a point the line (matrix of two values: x and y)

a scalar of the beginning of the interval of the x-domain on the figure

a scalar of the end of the interval of the x-domain on the figure

This function does not return any values, meaning it has no output arguments.  This function will first calculate the slope of the line using the two points. To do this, calculate the change in y divided by the change in x, aka the rise over run equation.  You will also need to find the y-intercept. To do this, use the x and y values of one of the points and solve for b in the equation b mx y (remember, m is the slope you just calculated).  A vector of x-values will need to be created using the beginning and ending values of interval of the x-domain, with an increment of 0.1.  Then, create the y-values using the equation mx + b Finally, plot the line in red.

924_user-defined function.png


Related Discussions:- User-defined function

Write MATLAB scripts for the following:, To accept two numbers from the use...

To accept two numbers from the user; Display all prime numbers between these two numbers.

Create a correlation matrix for variables in the data, In MATLAB, create a ...

In MATLAB, create a correlation matrix for all of the variables in the data (it should be an 8x8 matrix). To do this you will have to convert the "southern"variable into a number.

Ray tracing equations, i want to write a program in mat lab for optimizing ...

i want to write a program in mat lab for optimizing the design of lens help me how could i i am new user of matlab but previously i have work on C++.

Find and compute the natural frequencies, An electric overhead traveling cr...

An electric overhead traveling crane, consisting of a girder, trolley, and wire rope, is shown in figure. The girder has a flexural rigidity (EI) of 6x10 12 lb.in 2 and a span (L

Physics, how do you make a program for a parachute man falling to determine...

how do you make a program for a parachute man falling to determine his terminal velocity, having in consideration the drag force (cv^2). I have the formula to be v(i+1)=v(i)*delta(

Develop and submit a power-based mc snr, a) Develop and submit a power-base...

a) Develop and submit a power-based MC "SNR" simulator (derived from the voltage-based SNR program provided in MS Powerpoint file) that: i) Uses the following Input: Time period

Median, what are the steps we need to write in the script to get themedian ...

what are the steps we need to write in the script to get themedian for X values

Identify an equation that describes some chemical process, 1) Identify an e...

1) Identify an equation that describes some chemical process.  Your equation should have at least two parameters, at least one of which should contribute in a non-linear way. He

Create a super mario brothers game application, Create a Super Mario Brothe...

Create a Super Mario Brothers game in Matlab. The lines of codes do not matter. But, The requirements are: REQUIREMENTS: Modular design and implementation Algorithm docu

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd