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

Tropical forest carbon balance, As shown in Figure 1, Ecosystem carbon (C) ...

As shown in Figure 1, Ecosystem carbon (C) cycles in a tropical forest can be modeled using three "compartments":  aboveground (AG), belowground (BG), and soil organic matters (SOM

Implement a matlab function to calculate value, Implement a MatLab function...

Implement a MatLab function to calculate y.  The function should take two input arguments 1) A vector of parameters In the above example this would be of length 3, the first

Example of hold and legend function, Example of Hold and legend function: ...

Example of Hold and legend function: Running this script will generate two individual figure windows. If there is not any other active figure window, the first, that is the ba

Write a for loop to perform elementary row operations, Use Matlab to solve ...

Use Matlab to solve the following set of linear equations by Gaussian Elimination. Write a for loop to perform elementary row operations on the augmented matrix to produce

Need urgent help, i want to save the values of a particular equation in a f...

i want to save the values of a particular equation in a for loop.. for ex: for i=1:100 et=(x+yz); end thus how can i store the values of et at each iteration

Functions with local variables, Functions with Local Variables: The fu...

Functions with Local Variables: The functions we have seen faraway have been very easy. Though, in many situations the computations in a function are more complex, and may nee

write a matlab program to generate and plot the signal, 1.      Write a MA...

1.      Write a MATLAB program to generate and plot the signal                                     x1(n) = [3 2 -2 0 7],  n = 0,1,2,3,4. 2.      Write a MATLAB program to gen

Matlab code to run simulations of a batch reactor , Background Protein ther...

Background Protein therapeutics are a major component of the biotechnology industry, with sales estimated in the range of ~$99bn annually (2011) and steady market growth. Many phar

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