Create and send PWM signal from matlab to arduino

Hello

Can some one please help me on this.

I want to know how to create code or what function to use in MATLAB that will allow me to send PWM signal of 10 kHz and duty cycle of 55% to one of the output pins on the arduino uno.

It Must Be In MATLAB Environment.

Please if you one can help me that will be great this is for my project.

Thank You

http://forum.arduino.cc/index.php?topic=302918.msg2107098#msg2107098

Same project?

Yes; My fault i was unaware of that

Does the frequency have to be exactly 10kHz?

You will have to write an Arduino program setting up a custom timer configuration to achieve that frequency and duty cycle.

MATLAB has nothing to do with it, although MATLAB could be used to start and stop the Arduino output.

Here is a good overview on Arduino timers: Gammon Forum : Electronics : Microprocessors : Timers and counters

Hello Thank you for you reply it don't have to be exactly 10 khz it could be more or little less.

I will take look at the link you posted.

Thanks

I had looked at the link. i just want to explain little more just so i make sure that am asking the right question.

I had simulated a polarization fuel cell curve characteristics in matlab that are composed of "Voltage" and "current" that mimic the fuel cell for 50 watt system.

Using the MATLAB interfacing with arduino am able to use the ACS712 current sensor to read the current each time the load chances on the output of the buck converter. i was able to write this program in Matlab to read current and to compare it to the fuel cell current value that i upload to matlab with specified duty cycle for each current value.

Now my problem is am not able to some how send that given set duty cycle from matlab with set frequency of 10 khz, the only thing to keep in mind is the duty cycle will change every time current chances.

Hopefully this makes more scene.

Thank You

You are not giving us much to go on. What interface software are you using to communicate between MATLAB and the Arduino?

I thank you for your reply, am using the "Arduino io package from MATLAB".

Please feel free to ask me anything, maybe i don't do good job at explaining what is it i really need.

I thank you for your help