MatLab: Plotting in GUI uicontrol

If you're still having trouble, it could be due to the positioning of your axes or the values of your variables. It may be helpful to consult the documentation for the axes and plot commands or to seek assistance from other users or experts.
  • #1
Philosophaie
462
0
Having trouble plotting in a GUI. You have to first start with the axes command in the gui code. Then the plot. When you do the previous two actions noting comes up on the screen. The code:

axes('position',[1000,900,1000,900])
...
for k=9:1:-1
hold on;
for o=0:2*pi:.1;
x(k) = a(k) * (1 - (ecc(k) ^ 2)) / (1 + (ecc(k) * cos(paR(k) + o))) * cos(NR(k) + paR(k) + o);
y(k) = a(k) * (1 - (ecc(k) ^ 2)) / (1 + (ecc(k) * cos(paR(k) + o))) * sin(NR(k) + paR(k) + o);
plot(x(k),y(k));
end
end

All of the equations I am trying to plot are valid, data and all, it is just I am new to plotting in a GUI. There are probably some commands I am missing. Do you have any suggestions?
 
Physics news on Phys.org
  • #2
It looks like you're missing the line that actually draws the plot on the axes. Try adding this line after your loop:

plot(x,y);

This should draw the plot on the axes you have specified.
 
  • #3


It appears that you are attempting to plot multiple lines in a for loop within a GUI. In order for the plot to appear on the axes, you will need to use the "plot" command within the axes command that you have already set up. Additionally, you will need to specify the x and y coordinates for each line within the plot command. You may also need to adjust the axes limits and labels in order to properly display your data. It may also be helpful to use the "hold on" command before the for loop to ensure that all of the lines are plotted on the same axes. I would suggest looking into the documentation for the "plot" and "axes" commands in order to fully understand how they work within a GUI.
 

1. What is MatLab and why is it useful for plotting in GUI uicontrol?

MatLab is a programming software commonly used by scientists and researchers for data analysis and visualization. It is useful for plotting in GUI uicontrol because it provides a user-friendly interface and a wide range of tools for creating high-quality plots and graphs.

2. How do I create a plot in GUI uicontrol using MatLab?

To create a plot in GUI uicontrol, you can use the 'plot' function in MatLab. This function allows you to specify the x and y coordinates of your data points and customize the appearance of the plot, such as adding a title, labels, and legend. You can also use the 'uicontrol' function to add buttons, sliders, and other interactive elements to your plot.

3. Can I customize the appearance of my plot in GUI uicontrol?

Yes, you can customize the appearance of your plot in GUI uicontrol by using various MatLab functions and tools. For example, you can change the color, style, and size of the plot lines, add gridlines, and adjust the axes limits and labels. You can also use the 'figure' function to create multiple plots in one window and the 'subplot' function to arrange them in a grid.

4. Is it possible to save my plot in GUI uicontrol as an image file?

Yes, you can save your plot in GUI uicontrol as an image file by using the 'saveas' function in MatLab. This function allows you to specify the file format, such as PNG or JPEG, and the resolution of the saved image. You can also use the 'print' function to save your plot as a PDF or other document format.

5. Are there any resources available for learning more about plotting in GUI uicontrol with MatLab?

Yes, there are many online resources available for learning more about plotting in GUI uicontrol with MatLab. You can refer to the official MatLab documentation, which provides detailed information and examples on how to use various plotting functions and tools. You can also find tutorials, videos, and forums on the MatLab website and other online platforms where experienced users share their knowledge and tips for creating effective plots in GUI uicontrol.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
259
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
567
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
Back
Top