Borrar filtros
Borrar filtros

I want to transform Matlab code to arduino code, How could I do it? thanks

1 visualización (últimos 30 días)
Gianina Maria
Gianina Maria el 28 de Jun. de 2017
Editada: jpai el 28 de Jun. de 2017
Mi code is :
function [SaT,SaB,SbT,SbB,ScT,ScB] = fcn(u)
Ts= 0.0002;
Vdc=300;
a= u(1)/((2/3)*Vdc); % u(1) magnitud
x=u(2)*(180/pi) % u(2) angulo
u(3)
if (x>=0) && (x<(60)) k=1 Ta = ((a*Ts)/sind(60))*sind((k*60)-x)
Tb = ((a*Ts)/sind(-60))*sind(((k-1)*60)-x)
To = Ts-Ta-Tb
T1=To/4;
T2= T1+(Ta/2);
T3= T2+(Tb/2);
T4= T3+(To/2);
T5= T4+(Tb/2);
T6= T5+(Ta/2);
T7= T6+(To/4);

Respuestas (1)

jpai
jpai el 28 de Jun. de 2017
Editada: jpai el 28 de Jun. de 2017
If you would like to use MATLAB code to program an Arduino, one thing you could try would be the MATLAB Support Package for Arduino Hardware. The documentation related to getting started with the package can be found in the following link: http://www.mathworks.com/help/supportpkg/arduinoio/. This should allow you to directly program the Arduino via MATLAB without needing to convert the code.
If you would like to know more about what versions of MATLAB support this package, the answer found in the following link should provide that information: https://www.mathworks.com/matlabcentral/answers/242924-arduino-support-from-matlab-and-simulink-across-releases.

Categorías

Más información sobre Arduino Hardware en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by