How to Link MATLAB GUI User Inputs to a Simulation Equation?

In summary: GUIDE' command in Matlab. Then look on Matlab's website for information on how to operate guide and perhaps seek examples of other working GUI's. Other than that, maybe wait to make your own thread since ranger needs his own help here! Still, welcome to the forums, mussaco.And ranger, whilst this may have been an old post - I don't have more free time at the moment than required to make a simple post (i.e. this :smile:) but I will try to have a look at your files and let you know of the results. I would also suggest looking for an example GUI in the meantime if it's really bugging you. Are you still
  • #1
ranger
Gold Member
1,687
2
[Matlab virgin here]

I am in great need of some help. My task is to create GUI app to model simple harmonic motion of a spring with a mass attached to it. The requirements are to have the user be able to change every parameter of the equation:
my'' + cy' + ky' = f(t)

The m, c, k, and f are the usual constants - mass, spring constant and so on. Upon changing these parameters the user should be able to see a live visual of the spring moving and a graph for an analytical understanding of the motion through some specified time of action. By default the time of action should be about 10sec then the simulation stops and the parameters could be changed.

This is what I've done so far:
Made the complete GUI app. This includes all necessary user interfacing, the "live" graph, and spring animation.

Now what I need some help on is the relate all the user inputs to the formula to get the simulation.
Yea, I know I haven't done much because the GUI was the easy part, but I did get the "grid on" and "grid off" buttons to work:biggrin: Other than that, I pretty much didnt do any Callbacks and so on to help analyze the data.

Can someone help me get started?

http://linuxfreak87.googlepages.com/HarmonicSpring.m <-- m-file
http://linuxfreak87.googlepages.com/HarmonicSpring.fig <--fig file

Using Matlab 7 R14

--thank you.
 
Last edited:
Physics news on Phys.org
  • #2
hi group community
i am getting it dificult to create GUI for solving equations for y=mx+c;
i have failed to edit m file but if completed to create the figure
can someone hel;p me to intiate and edit the call back function
thanks
 
  • #3
mussaco said:
hi group community
i am getting it dificult to create GUI for solving equations for y=mx+c;
i have failed to edit m file but if completed to create the figure
can someone hel;p me to intiate and edit the call back function
thanks

try 'GUIDE' command in Matlab. Then look on Matlab's website for information on how to operate guide and perhaps seek examples of other working GUI's. Other than that, maybe wait to make your own thread since ranger needs his own help here! Still, welcome to the forums, mussaco.

And ranger, whilst this may have been an old post - I don't have more free time at the moment than required to make a simple post (i.e. this :smile:) but I will try to have a look at your files and let you know of the results. I would also suggest looking for an example GUI in the meantime if it's really bugging you. Are you still working on the problem?
 
  • #4
i am still working on the problem
but does the equation y=mx+c apperas on the opening function or on the callback function to make the gui calculate?
regards
mussa
 
  • #5
ranger said:
[Matlab virgin here]

I am in great need of some help. My task is to create GUI app to model simple harmonic motion of a spring with a mass attached to it. The requirements are to have the user be able to change every parameter of the equation:
my'' + cy' + ky' = f(t)

The m, c, k, and f are the usual constants - mass, spring constant and so on. Upon changing these parameters the user should be able to see a live visual of the spring moving and a graph for an analytical understanding of the motion through some specified time of action. By default the time of action should be about 10sec then the simulation stops and the parameters could be changed.

This is what I've done so far:
Made the complete GUI app. This includes all necessary user interfacing, the "live" graph, and spring animation.

Now what I need some help on is the relate all the user inputs to the formula to get the simulation.
Yea, I know I haven't done much because the GUI was the easy part, but I did get the "grid on" and "grid off" buttons to work:biggrin: Other than that, I pretty much didnt do any Callbacks and so on to help analyze the data.

Can someone help me get started?

http://linuxfreak87.googlepages.com/HarmonicSpring.m <-- m-file
http://linuxfreak87.googlepages.com/HarmonicSpring.fig <--fig file

Using Matlab 7 R14

--thank you.

hi dear I'm now working on the same project as you done it
and have thesame problem as you had.
can you mail me on s.hosseini1365@gmail.com to how can i do it!
tanks a lot.
 
  • #6
You don't need to fill most of the callbacks. I've made several GUI's and if your code isn't amazingly complicated then you can just put the entire code inside the callback of your "Start Simulation" button or whatever you've called it.

I've never made a realtime simulation like you're trying to do now but i think the standard MATLAB way of doing such a thing is by setting your main function inside of a loop and adding a very small pause at the end.
 
  • #7
Hi

I am facing trouble with the graphics in the GUI, I am trying to do something similar but i donwload your files and can't find where did you "draw" the mass-spring sistem, please could you tell me how did you draw that "live" graph
 
Last edited:

Related to How to Link MATLAB GUI User Inputs to a Simulation Equation?

1. What is Matlab GUI programming?

Matlab GUI programming refers to the process of creating graphical user interfaces (GUIs) using the Matlab programming language. GUIs provide a visual way for users to interact with software and can greatly enhance the user experience.

2. Why would I use Matlab GUI programming?

Matlab GUI programming is useful for creating user-friendly and intuitive interfaces for complex scientific and engineering applications. It allows for the integration of data visualization, analysis, and other Matlab functions into a single interface, making it easier for users to interact with and understand the data.

3. How do I get started with Matlab GUI programming?

To get started with Matlab GUI programming, you will need to have a basic understanding of Matlab programming. You can then use the built-in guide tool in Matlab to create and design your GUI. There are also many online tutorials and resources available to help you get started.

4. Can I customize the appearance of my Matlab GUI?

Yes, you can customize the appearance of your Matlab GUI by using the guide tool to add different components such as buttons, menus, and text boxes. You can also change the color scheme, font, and layout to match your preferences and make your GUI more visually appealing.

5. Are there any limitations to Matlab GUI programming?

While Matlab GUI programming offers a wide range of capabilities, there are some limitations to keep in mind. For example, the graphical capabilities of Matlab may not be as advanced as other programming languages, and the creation of more complex GUIs may require additional coding. Additionally, Matlab GUIs may not be as easily portable to different operating systems compared to other programming languages.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
7K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
12K
  • Programming and Computer Science
Replies
1
Views
3K
Back
Top