Given a mathematical function as follows:- = { ( 3 + 10), ≥ 9 4 + 50, < 9 15, < 0 Write a MATLAB script file to plot the given function for -10 ≤ x ≤ 100

Respuesta :

Answer:

x = [-10:0.01:100];

y = 6sin(x) + cos(4*x) - 0.3;

plot(x, y)

xlabel('x');

ylabel('y');

title('Plot of the Trig Function');

Note: the function was not properly specified in the question, so a sample function y = 6sin(x) + cos(4*x) - 0.3 was used

Explanation:

The following steps should be taking to plot the graph of a function −

1. Define the independent variable range of values

for example: x = [-10:.01:100]; defines x starting from -10 to 100 with a step of 0.01

2. Define your dependent function, y = f(x)

for example: y = 6sin(x) + cos(4*x) - 0.3;

3. Call the matlab plot function plot(x, y)

4. Additionally, you can define the title, legends, axis labels, etc.

xlabel('x');

ylabel('y');

title('Plot of the Trig Function');

legend('y = 6sin(x) + cos(4*x) - 0.3');

ACCESS MORE