Question

1. Now generate y array using the function file my_func for the x array varying from...

1. Now generate y array using the function file my_func for the x array varying from 0 to 4 with an increment of 0.2. Generate x and y arrays without using any loop statement and do not print these arrays.

2. Off of question 1. Using MATLAB plot routine, plot y-array against the x-array generated in question 1. On this plot show grid lines, label the axes as x and y, and write the text ‘y=f(x)’ next to the plotted curve.

Homework Answers

Answer #1

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

Note brother as mentioned in first part there should be a function file named my_func which is to be called by the script below.

1)

clc
clear all
close all
x=0:0.2:4;
y=my_func(x);

2)

clc
clear all
close all
x=0:0.2:4;
y=my_func(x);
plot(x,y);
grid on;
xlabel('X-values');
ylabel('Y-values');
text(x(floor(length(x)/2)),y(floor(length(x)/2))+rand/10,'y=f(x)')

Kindly revert for any queries

Thanks.

Know the answer?
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
Similar Questions
USING MATLAB (A) Use the rand command to generate “X” of size [10000 1] and the...
USING MATLAB (A) Use the rand command to generate “X” of size [10000 1] and the command histogram to plot the probability distribution of “X” along with axis labels and a title that includes the mean and variance for “X”. (B) Use a while loop and the rand command to generate “X1”, also of size [10000 1] but with each element of “X1” being the mean of 2 “samples” generated using rand, i.e. a “sample size” of 2 separate numbers...
In MATLAB, generate a 3D plot as follows: Create 2 vectors x and y, both ranging...
In MATLAB, generate a 3D plot as follows: Create 2 vectors x and y, both ranging from -5 to 5 with interval of 0.05 using linspace or colon operator. Generate grid of values X and Y using the vectors x and y. Define the variable Z as follows: Z = 2X3 + 4Y2 + 7 +sinX3 + Y2 Generate a surface and a mesh plot with the variables X,Y,Z. Show your plots.
Curve-Fit Function USING MATLAB Using the top-down design approach, develop a MATLAB function A8P2RAlastname.m that reads...
Curve-Fit Function USING MATLAB Using the top-down design approach, develop a MATLAB function A8P2RAlastname.m that reads data from a file and performs regression analysis using polyfit and polyval. The function shall have the following features: The input arguments shall include the file name (string), a vector of integers for the degrees of polynomial fits to be determined, and an optional plot type specifier (‘m’ for multiple plots, ‘s’ for a single plot - default). The data files will be text...
Assignments Generate and plot the signal x1(t) = 1+ sin (4pt), for t ranging from -1...
Assignments Generate and plot the signal x1(t) = 1+ sin (4pt), for t ranging from -1 to 1 in 0.001 increments. Use proper axes labels with title. Generate and plot the function x2(t) = sin (30pt), for t ranging from -1 to 1 in 0.001 increments. Use proper axes labels with title. Generate and plot the combination function x3(t) = x1(t)*x2(t) as above. Use proper axes labels with title. Generate and plot the sum of two cosine waves   v1(t) =...
Using Python: Create a code to generate 1001 values between 0 and 10 (essentially, start from...
Using Python: Create a code to generate 1001 values between 0 and 10 (essentially, start from 0 and use increment 0.01) and for each value ? ∈ [0,10] calculate sin(?) and the derivative of ?(x) = sin(?) using the central difference method: ????(?)/?? = ?(?+0.01)−?(?−0.01) 2∙0.01 . Output the result in a file using the print command: print (?, ???(?) , ????(?), ??? =′ ′, ??? =′\ ? ′ , ???? = ??) Recall that the output file must be...
USING MATLAB Code for pseudo Random Input N M=0 For i=1 to N X=rand# Y=rand# If...
USING MATLAB Code for pseudo Random Input N M=0 For i=1 to N X=rand# Y=rand# If X^2+ y^2 <= 1, then M=M+1 End the loop Print M/N (This is the probability) Print M/N (this is approximately = Py
SIGNALS AND SYSTEMS Experiment 1    Signal Generation Date: January 1-8, 2018 The purpose of this...
SIGNALS AND SYSTEMS Experiment 1    Signal Generation Date: January 1-8, 2018 The purpose of this laboratory is to familiarize you with the basic commands in MATLAB for signal generation and verify the generated signal. Objectives 1.Learn basic MATLAB commands and syntax, including help system. 2.Use MATLAB ( from Citrix) to generate and plot different signals. Assignments Generate and plot the signal x1(t) = 1+ sin (4pt), for t ranging from -1 to 1 in 0.001 increments. Use proper axes...
Arrays, loops, functions: Lotto Element Repeated Function Write a function that that takes as parameters an...
Arrays, loops, functions: Lotto Element Repeated Function Write a function that that takes as parameters an array of ints, an int value named element, and an int value named end. Return a bool based on whether the element appears in the array starting from index 0 and up to but not including the end index. Generate Random Array Write a function that takes as parameters an array of integers and another integer for the size of the array. Create a...
Using MatLab 2. Given the parametric equations x = t^3 - 3t, y = t^2-3: (a)...
Using MatLab 2. Given the parametric equations x = t^3 - 3t, y = t^2-3: (a) Find the points where the tangent line is horizontal or vertical (indicate which in a text line) (b) Plot the curve parametrized by these equations to confirm. (c) Note that the curve crosses itself at the origin. Find the equation of both tangent lines. (d) Find the length of the loop in the graph and the area enclosed by the loop. 3. Use what...
Q) a) create a matrix named as X of evenly spaced values from 0 to 50,...
Q) a) create a matrix named as X of evenly spaced values from 0 to 50, with an increment of 10. b) a) create a matrix named as Y of evenly spaced values from 500 to 1000, with an increment of 3. c)a) create a matrix named as Z, the value of the 1st row is from 1 to 10, 2nd row from 2 to 20 with increment of 2, 3rd row 3 to 12. using subplot divide the window...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT