Designing a Controller for Quadroto with MATLAB/SIMULINK

  • Context: MATLAB 
  • Thread starter Thread starter armin11
  • Start date Start date
  • Tags Tags
    Controller Designing
Click For Summary

Discussion Overview

The discussion revolves around designing a controller for a quadroto using MATLAB and SIMULINK, focusing on defining initial values for velocities within an embedded function and addressing errors encountered during simulation.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant seeks guidance on how to set initial values for velocities in an embedded function so that they are only defined at t=0 and subsequently updated through feedback.
  • Another participant suggests using control system design to define initial states as desired values and exporting the operating point to the model workspace.
  • A participant reports an error occurring at time 0.3 in the simulation, noting that the program runs correctly until that point and questions whether it is possible to exclude that time from the program.
  • There are inquiries about how to upload the program for review, indicating a need for visual assistance in troubleshooting.
  • One participant recaps the use of an embedded function for defining initial values and discusses the implications of setting initial conditions for integrators, suggesting methods to define these conditions through the integrator block or control system toolbox.

Areas of Agreement / Disagreement

Participants express differing views on how to handle initial values and errors in the simulation, with no consensus reached on the best approach to resolve the issues presented.

Contextual Notes

Participants mention specific errors and conditions related to the simulation, but details on the underlying assumptions or definitions are not fully explored, leaving some aspects unresolved.

armin11
Messages
66
Reaction score
0
hi,
I'm designing a controller for quadroto with MATLAB and I'm using SIMULINK to do this.
In the embedded function I have to define the initial values so that the velocities take initial values but then in the embedded function the derivative of the velocities is calculated and then there is an integrator after the embedded function that returns to the velocities.I should define initial values so that velocity input takes these values once and after that at each step velocities are entered by the feedback and initial values should't be entered.How can I do this?Is there a way to do this?for example in embedded function to write a code that takes the initial values at t=0 and after that inputs are from feedback?please help.
 
Physics news on Phys.org
Try using control system design and defining the initial states of your operating point as your desired values. Then export the operating point to the model workspace.

A screen shot of your system and your error would also help immensely, since your description isn't 100% clear.
 
there is an error at time 0.3 of the simulink ,but if we run the program till time 0.3 it gives correct answer.Can I delete this time form the program?there is an Nan error at time 0.3,but there isn't any denominator in the equation.I don't know how to upload the program here to see your opinion.
 
armin11 said:
I don't know how to upload the program here to see your opinion.

Run the program until you reach the error then use this button on your keyboard

[PLAIN]http://www.askdrtech.com/solutions/image.axd?picture=2009%2F8%2FPrint1.jpg

Also, you can use this button to capture images of the rest of your program. See http://www.seoconsultants.com/windows/print-screen/

for details
 
Last edited by a moderator:
the first one is a picture of the whole simulink,the second is my embedded function and the third is the error,as you can see the error is at the integrator of hdot and from the embedded function we see that hdot doesn't have a denominator.
 

Attachments

  • 1.jpg
    1.jpg
    36.1 KB · Views: 565
  • 2.jpg
    2.jpg
    37.1 KB · Views: 526
  • 3.jpg
    3.jpg
    47.8 KB · Views: 550
Just to recap, you are using an embedded function to define your initial values if your states, correct?

If you do this, the initial values at your integrators are all 0. There are a few ways to go about defining initial values of your states. One is to click on your integrator block and define the initial condition source as internal and input your data there.

The second way to do this is to use the control system toolbox and define the initial states in your operating point.
 

Similar threads

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