Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
Gianina Maria
Gianina Maria am 28 Jun. 2017
Bearbeitet: jpai am 28 Jun. 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);

Antworten (1)

jpai
jpai am 28 Jun. 2017
Bearbeitet: jpai am 28 Jun. 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.

Kategorien

Mehr zu Arduino Hardware finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by