Question

How can I plot the functions with Matlap?

How can I plot the functions with Matlap?

Homework Answers

Answer #1

To plot the graph of a function, you need to take the following steps ?

  • Define x, by specifying the range of valuesfor the variable x, for which the function is to be plotted

  • Define the function, y = f(x)

  • Call the plot command, as plot(x, y)

Following example would demonstrate the concept. Let us plot the simple function y = x for the range of values for x from 0 to 100, with an increment of 5.

Create a script file and type the following code ?

x = [0:5:100];
y = x;
plot(x, y)

Let us take one more example to plot the function y = x2. In this example, we will draw two graphs with the same function, but in second time, we will reduce the value of increment. Please note that as we decrease the increment, the graph becomes smoother.

Create a script file and type the following code ?

x = [1 2 3 4 5 6 7 8 9 10];
x = [-100:20:100];
y = x.^2;
plot(x, y)
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
How do I graph periodic wave functions electronically? Is it possible to use calc plot 3D...
How do I graph periodic wave functions electronically? Is it possible to use calc plot 3D or Wolfram Alpha? I'm trying to visualize y(x,t) = A sin(kx + wt + phi)
1. how to create residual vs. fitted plot in R ? (I know I can use...
1. how to create residual vs. fitted plot in R ? (I know I can use plot(), but I ONLY want one graph instead of four graphs created by plot(). ) 2.how to find outliers from a scatter plot in R? I need the code.
How can I create a scatter plot where I have my variables?
How can I create a scatter plot where I have my variables?
(a) Generate the following discrete functions using MATLAB. Plot the two functions on the same page...
(a) Generate the following discrete functions using MATLAB. Plot the two functions on the same page using MATLAB stem function. For x2[k] plot the real and imaginary parts separately. Therefore, a total of three plots will be plotted on one page. (i) x1[k]= -5.1sin((0.1*pi*k)-3*pi/4)+1.1cos(0.4*pi*k) such that k belongs in[-10,40] (ii)x2[k]= ((-0.9)^k)*exp(i*pi*k/10) such that k belongs in[0,100] (b) Are x1[k] and x2[k] periodic sequences. If so, what are their periods? Mark them on the plots. (c) Calculate the total energy of...
Mathematica Question: Using Mathematica's Plot and FindRoot functions, approximate the three smallest and three largest positive...
Mathematica Question: Using Mathematica's Plot and FindRoot functions, approximate the three smallest and three largest positive solutions to cosx2=sinx. Find their values with FindRoot. Edit: I believe it is cos x^2= sin x, this is exactly as it's written
normal quantile plot Hello! I'm supossed to make a normal quantile plot, and i read that...
normal quantile plot Hello! I'm supossed to make a normal quantile plot, and i read that "The basic idea of the normal quantile plot is to compare the data values with the values one would predict for a standard normal distribution". But I thought that only the residual was normal distributed in linear regression. Can somebody explain why we suddenly state, that the raw data is normal distributed?
how can you use a piecewise functions for nonlinear functions in the real world. List two...
how can you use a piecewise functions for nonlinear functions in the real world. List two examples
float, void print_instructions, print_results What other functions can i use to replace this one, Ones that...
float, void print_instructions, print_results What other functions can i use to replace this one, Ones that are the same functions, but different name
matlab keep ignoring negative values when i plot the data.... what should i do to plot...
matlab keep ignoring negative values when i plot the data.... what should i do to plot negative numbers...
using mathmatica how would I plot a 60Hz representation of noise? please use mathmatica code!
using mathmatica how would I plot a 60Hz representation of noise? please use mathmatica code!