Matlab GUI programming help

  • MATLAB
  • Thread starter ranger
  • Start date
  • #1
ranger
Gold Member
1,676
1

Main Question or Discussion Point

[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 havent 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:

Answers and Replies

  • #2
2
0
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
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
2
0
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
2
0
[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 havent 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
22
0
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
1
0
Hi

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

Related Threads on Matlab GUI programming help

  • Last Post
Replies
0
Views
2K
  • Last Post
Replies
0
Views
2K
Replies
6
Views
3K
  • Last Post
Replies
1
Views
752
Replies
4
Views
6K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
0
Views
6K
  • Last Post
Replies
1
Views
4K
Replies
1
Views
7K
Replies
0
Views
6K
Top