Bal and Plate with matlab and PD

Hello, make ball and plate system project. i use camera as sensor with matlab/simulink to make detect for the ball. from matlab/simulink with video processing i will get the error position ( difference between desired position and actual position) and send it to PD controller then send the result to arduino using serial COM i want to establish arduino program that take this result and send it to stepper motor that rotate plate axis to move ball to desired position.

Please i need help to establish require program.

Please i need help to establish require program.

For the PC? Or for the Arduino?

If it is the Arduino code that you need help with, there is a lot that you have failed to describe. Which stepper motor driver are you using? An Arduino can NOT directly driver a stepper motor that is capable of doing anything useful.

What data are you sending the Arduino? At what baud rate? How is that supposed to relate to the number of steps to take? How does that relate to the time between steps?

Use the matlab for arduino package. It's basically a software package that hijacks the arduino pins and allows matlab to control them. This allows more straightforward feedback and programming approaches. There is even a simulink for arduino package.