I want to transform Matlab code to arduino code, How could I do it? thanks
1 次查看(过去 30 天)
显示 更早的评论
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);
0 个评论
回答(1 个)
jpai
2017-6-28
编辑:jpai
2017-6-28
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Support Package for Arduino Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!