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.
`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.
Get Answers For Free
Most questions answered within 1 hours.