MATLAB Control System | Following Path in 2D

  • Context: MATLAB 
  • Thread starter Thread starter footballxpaul
  • Start date Start date
  • Tags Tags
    Matlab Path
Click For Summary

Discussion Overview

The discussion revolves around implementing a control system in MATLAB to follow a specified 2D path, including motion equations and control laws. Participants explore the feasibility of using MATLAB versus Simulink and discuss the formulation of ordinary differential equations (ODEs) for motion control.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant seeks guidance on how to make a point follow a path in 2D using MATLAB, specifically moving forward and turning at specified angles.
  • Another participant inquires whether Simulink or plain MATLAB would be more suitable for the task.
  • A participant confirms that the task can be accomplished using just MATLAB and introduces the concept of a simple system with a mass and a linear actuator.
  • There is a discussion about deriving a differential equation for the motion of the mass using a proportional control law.
  • A participant expresses interest in PID control and asks how to integrate second-order ODEs into a PID framework.
  • A simple example of a differential equation is presented, illustrating how to combine the control law with the motion equations.
  • Participants discuss the representation of states as vectors for use with MATLAB's ODE solvers and mention the preference for the "ode45" solver.

Areas of Agreement / Disagreement

Participants generally agree that the task can be accomplished using MATLAB, but there is no consensus on whether Simulink would be a better option. The discussion on control laws and ODE formulation remains exploratory, with no definitive conclusions reached.

Contextual Notes

Limitations include potential missing assumptions regarding the control system design and the specific parameters used in the equations. The discussion does not resolve the effectiveness of different control strategies or the appropriateness of using Simulink versus MATLAB.

Who May Find This Useful

Individuals interested in control systems, MATLAB programming, and mathematical modeling of motion may find this discussion relevant.

footballxpaul
Messages
30
Reaction score
0
Hi I am trying to figure out MATLAB control system stuff a little more, what would be the best way to go about in 2d having a point with all the equations of motion inputed for direction and distance try to follow a set path like 10 ft forward from (0,0) and turning 90 degrees right and going another 10 ft, to see how accurate the equations of motion can make the path. Thanks
 
Physics news on Phys.org
Hi Paul. Do you have simulink or are you talking about plain old MATLAB to do this?
 
matlab, i wouldn't be opposed to using simulink to do it. I just have never used simulink. Would simulink be better for this?
 
Yes you can do it with just matlab.

Say you had a simple system like just moving a mass from x=0 to x=1 with a linear actuator that could provide a force on the mass in response to some "control law". Are you familiar with how to derive a differential equation for the motion of the mass?

For example let's say we have a simple proportional control law, where the actuator provides a force that is proportional (and opposite) to the error in the current x position of the mass.

Do you know how to make an ODE (ordinary differential equation) for that system?
 
Like PID? No I haven't set one up before but I am reading up on it. How would I use my 2nd order ode's into the pid?
 
Ok here's a simple example. Say you had the simple system (just moving a mass) :
[tex]\ddot{x} = \frac{F}{m}[/tex]

And you use the control law.
[tex]F = -k_p(x - x_d)[/tex]

Combine the equations to make the DE.
[tex]\ddot{x} = \frac{k_p}{m} (x_d - x)[/tex]

And just for a simple example let's make all the parameters unity.
[tex]\ddot{x} = (1 - x)[/tex]

To use matlabs ODE solvers you need to represent the states as a vector. I'll use x(1) for x and x(2) for velocity, [itex]\dot{x}[/itex].

[tex]\tilde{x} = [x\, ; \, \dot{x} ][/tex]

Then you can use one of the ODE solvers (I prefer "ode45") to solve the equation and make a plot of the output response.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
8K
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 6 ·
Replies
6
Views
6K