I have a code which is design a PI code , but i have to implement it via matlap , any help please

Second_TaskPi.ino (815 Bytes)

I have a code which is design a PI code , but i have to implement it via matlap , any help please

Second_TaskPi.ino (815 Bytes)

What's the problem? ...

I would guess that the OP doesn't know how to write a MATLAB program.

By PI I am assuming you are designing a proportional-integral controller. Matlab's Simulink should do the trick. What does your plant look like?

the problem is that i can not connect the arduino with the matlab . in order that the matlab could read the transfer function of the motor ?

You have to be more specific... It might be clear enough in your head but we don't know anything of your project, so please explain it in details. What's the role of the Arduino? What's the role of the MATLAB? Are they supposed to communicate in real time?

I don't see anything related to the motor transfer function in your Arduino code. All I can see is a PI code (and at first sight, you're not dealing the I term as it should be).

heshamgoda: the problem is that i can not connect the arduino with the matlab . in order that the matlab could read the transfer function of the motor ?

Second_Task huh?

Sounds like we're doing your lab work for you...

I don't see any attempt to connect to matlab in your code - that's probably the issue.

Try this.

I don't recall matlab doing system ID, that's more something that *simulink* can probably deal with (if you actually some kind of block that can do fast enough IO with your hardware) - have a look here for a idea of the general framework:

http://ctms.engin.umich.edu/CTMS/index.php?example=MotorSpeed§ion=SystemModeling etc.