Write a MATLAB program file script file that accomplishes th

Write a MATLAB program file (script file) that accomplishes the following. Save the file as \"Problem l .m\" For the function y_1 = (x_1^3 + 1)^2/x_1^2 + 2, calculate the value of y, for the following values of x_1: -1.6 -1.2 -0.8 -0.4 0 0.4 0.8 1.2. Solve the problem by first creating a vector x1, and then creating a vector y1, using element-by-element calculations For the function y_2 = 8k^2/x_2^2 + 4k^2, calculate the value of y_2 for the following values of x_2: -3, -2 8, -2.6, 2.6, 2.8, 3. Define k as a scalar k = 0 8. Solve the problem by first creating a vector x2, and then creating a vector y2, using element-by-clement calculations. Plot the two functions together on one plot Label the x-axis as \"Independent Variable [x]\" and label the y-axis as \"Dependent Variable (y = f (x)]\" Include a legend that labels the two curves as \"Function A\" and \"Function B\".

Solution

clc
clear all
for x1 = -1.6:0.4:1.2
y1= ((x1.^3 + 1).^2)/(x1.^2+2)
end
for x2 =-3:0.2:3
k=0.8;
y2 = (8*k^2)/(x2.^2+4*k^2)
end

plot(x1,y1,\'color\',\'r\'); hold on;
plot(x2,y2,\'color\',\'b\');

run this code in matlab

 Write a MATLAB program file (script file) that accomplishes the following. Save the file as \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site