Question

In: Computer Science

The following equation can be used to compute values of y as a function of x:...

The following equation can be used to compute values of y as a function of x: ? = ?? −??sin(??)(0.012? 4 − 0.15? 3 + 0.075? 2 + 2.5?) where a and b are parameters. Write a Matlab script file (m file) with the following steps: Step 1: Define scalars a = 2, b = 5. Step 2: Define vector x holding values from 0 to π/2 in increments of Δx = π/40. Step 3: generate the vector y using element-wise product (dot product). Step 4. Compute the vector z = y 2 where each element holds the square of each element of y. Step 5: Combine x, y, and z into a matrix w, where each column holds one of the variables, and display w using the short g format. Step 6: Generate plots of y and z versus x using dashed lines. Step 7: Include legends for each plot (for y vs. x plot, use “y” as legend; for z vs. x plot, use “z” as legend).

Solutions

Expert Solution

`Hey,

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

clc
clear all
close all
b=5;
a=2;
x=transpose(0:pi/40:pi/2);
y=sin(b*x).*(0.012*x.^4-0.15*x.^3+0.075*x.^2+2.5*x).*(b*exp(-a*x));
z=y.^2;
format short g;
w=[x y z];
disp(w)
plot(x,y,'--',x,z,'--');
xlabel('X');
ylabel('Amplitude');
title('Plot of y and z');
legend('y','z');

Kindly revert for any queries

Thanks.


Related Solutions

Solve the following differential equation: y''+e^{-y}=0 where y is only a function of x.
Solve the following differential equation: y''+e^{-y}=0 where y is only a function of x.
PLEASE USE PYTHON CODE Compute the zero of the function y(x) from the following data: x...
PLEASE USE PYTHON CODE Compute the zero of the function y(x) from the following data: x = 0.2, 0.4, 0.6, 0.8, 1.0 y = 1.150, 0.855, 0.377, -0.266, -1.049 Use inverse interpolation with the natural cubic spline
For the differential equation (2 -x^4)y" + (2*x -4)y' + (2*x^2)y=0. Compute the recursion formula for...
For the differential equation (2 -x^4)y" + (2*x -4)y' + (2*x^2)y=0. Compute the recursion formula for the coefficients of the power series solution centered at x(0)=0 and use it to compute the first three nonzero terms of the solution with y(0)= 12 , y'(0) =0
Compute the correlation between X and the transformed Y values. Distance jumped in inches (X) Distance...
Compute the correlation between X and the transformed Y values. Distance jumped in inches (X) Distance of discus throw in inches (Y) 3 12 1 36 4 60 1 12 3 48 5 12 1 24
1.What values of x,  y and z balance the equation: x SO2    +   y H+   +    Cr2O72– → 3...
1.What values of x,  y and z balance the equation: x SO2    +   y H+   +    Cr2O72– → 3 SO42–  + z Cr3+ +   H2O ? 2.What is the stoichiometric ratio of solid phosphorus (P) to chlorine gas (Cl2) required to give phosphorus trichloride (PCl3)? 3.What is the mass fraction of carbon in aniline C6H5NH2 expressed as a percentage? 4. Arrange the following in order of increasing amount of substance: (i)            24 g of sodium metal (ii)           40 g of carbon dioxide...
Explain how the graph of the sine function can be used to graph y = csc x.
Explain how the graph of the sine function can be used to graph y = csc x.
Draw indifference curves with equation (x + 2) (y + 1) = a, where the values...
Draw indifference curves with equation (x + 2) (y + 1) = a, where the values a = 6, 8, and 10
Find the equation of the plane tangent to the function f(x, y) = (x^2)(y^2) cos(xy) at...
Find the equation of the plane tangent to the function f(x, y) = (x^2)(y^2) cos(xy) at x = y = π / √ 2 . Using this linearization to approximate f, how good is the approximation L(x, y) ≈ f(x, y) at x = y = π / √ 2 ? At x = y = 0? At (x, y) = (π, π)?
Two linearly independent solutions of the following equation (1 − x) y″  +  x y′  − ...
Two linearly independent solutions of the following equation (1 − x) y″  +  x y′  −  y  =  0 are  y1(x)  =  4ex and  y2(x)  =  8x. (a) Find the Wronskian W(y1, y2) of y1 and y2. (b) Using the method of variation of parameters, find a particular solution of (1 − x) y″  +  x y′  −  y  =  2(x − 1)2 e −x
Let u(x, y) be the harmonic function in the unit disk with the boundary values u(x,...
Let u(x, y) be the harmonic function in the unit disk with the boundary values u(x, y) = x^2 on {x^2 + y^2 = 1}. Find its Rayleigh–Ritz approximation of the form x^2 +C1*(1−x^2 −y^2).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT