Designing a Controller for Quadroto with MATLAB/SIMULINK

  • Context: MATLAB 
  • Thread starter Thread starter armin11
  • Start date Start date
  • Tags Tags
    Controller Designing
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
5 replies · 5K views
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: 577
  • 2.jpg
    2.jpg
    37.1 KB · Views: 539
  • 3.jpg
    3.jpg
    47.8 KB · Views: 561
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.