How to use Ode45 in App Designer
3 views (last 30 days)
Show older comments
Hello everyone,
I am looking for help with my GUI. I am trying to make a simple GUI that uses a mass spring damper system to model a 1/4 mass car suspension system. The GUI allows the user to input the mass, spring constant, damping coefficient and the simulation time. The code should use Ode45 in order to solve the equations and output a graph that displays the vertical displacement of the mass. I have the code working in Matlab however, this is my first time using App Designer and I am having a bit of trouble with using the Ode45 function as well as editing the code to work within App Designer rather than Matlab.
Attached is the current code and a model of the mass spring damper system. When running the code the error "Invalid default value for property 'M' in class 'GUI_Project': Unable to resolve the name app.Mass1.Value." is appearing in the first line. Any feedback is very helpful.
Thanks in advance,
Brendan
0 Comments
Answers (1)
Mario Malic
on 8 Dec 2020
Hi Brendan,
You only define properties in the property section, not their values.
properties (Access = private)
a
b
c
end
You can define property values in startup function startupFcn, or directly in the callback you've written (wouldn't recommend). How to create startupFcn, you can read here
You have assigned the value to properties correctly, but you should do that in startupFcn.
0 Comments
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!