How to Resolve a Plotting Error in Matlab?

In summary, the conversation is about a person trying to plot data using an equation in Matlab. They have all the x data points and are trying to generate y values for each point. However, they are getting an error in line 4 of their code and are seeking help to figure out what they are doing wrong. The person responding also suggests posting in a different forum for better assistance.
  • #1
solas99
69
1
HI,

i have a set of data that i want to plot with matlab, using an equation.
i have all x data points and want to generate y values for each x data point.

function y =marko(x)


y= (4.11/1.98)*{(1/4*((1-x/L).^2))-(1/4)-(x/L)};

x=(218+data points)

from the command window i have called:

y=marko(x);

i keep getting an error in marco (line4)

can someone help me figure out what i am doing wrong here.
 
Physics news on Phys.org
  • #2
Can you post your complete code?

I'm unsure what your L is.

You might also have better luck posting this sort of thing in the homework help, or in the general computer science locations in the future.
 
Last edited:

Related to How to Resolve a Plotting Error in Matlab?

1. How do I plot a model in Matlab?

To plot a model in Matlab, you first need to define the data points or equations that make up your model. Then, you can use the "plot" function to create a visual representation of your model. You can also add labels, titles, and customize the appearance of your plot using various built-in functions.

2. Can I plot multiple models on the same graph in Matlab?

Yes, you can plot multiple models on the same graph in Matlab. To do this, you can use the "hold on" command after each plot function. This will allow you to continue adding new plots to the same graph without erasing the previous ones.

3. How can I save my plotted model as an image in Matlab?

To save your plotted model as an image in Matlab, you can use the "saveas" function. This function allows you to specify the file format and name for your image. Alternatively, you can also use the "print" function to save your plot as an image file.

4. Is it possible to add a legend to my plotted model in Matlab?

Yes, you can add a legend to your plotted model in Matlab. To do this, you can use the "legend" function and specify the labels for each of your plotted models. You can also customize the location and appearance of your legend using various optional arguments.

5. How can I animate my plotted model in Matlab?

To animate your plotted model in Matlab, you can use the "pause" and "drawnow" functions inside a for loop. This will allow you to update the plot at each iteration and create a moving animation. You can also use other animation functions such as "getframe" and "movie" for more advanced animations.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
954
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
Back
Top