At the beginning of 2020 Matlab(Simulink) has stop the block called Fcn. I need a block in Simlink that is the same in 2021a.Please help.
4 ビュー (過去 30 日間)
古いコメントを表示
clear all
close all
clc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%the equation put in Fcn (block)is (-m*g-sgn(u[1]*A*rho*u[1]^2)/m in simulink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%The rest of the code I can work out myself. I need a substitution for Fcn block please.
g=9.81
d=0.1;
rhoMaterial =100;
R=.287 % gas constant for air kj/kg;
p=101.325 % barometric pressure
t=20; % temperture
rhoAir =p/(R*(273+t));%
A=pi*d.^2/4;
m=rhoMaterial*1/6*pi*d.^3
Cd=0.6;%0.6;
theta=40' %54 %boomerang
v=40;
xdot0 =v*cos(theta*pi/180);
ydot0=v*cos(theta*pi/180);
x0=0;
y0=0;
wx=-10; %-10
wy=0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% call the Simulink model. Results(states)returned to Workspace in xout
sim('traject');
%plot(xout(:,1),xout(:2))
quiver(xout(:,1),xout(:,2),xout(:,3),xout(:,4))
axis equal
hold on
plot(xout(end,1),xout(end,2),'ro')
xlabel('x [m]')
ylabel('y [m]')
title(sprintf('v=%.2fm/s, \\theta=%.1f^o',v,theta))
grid on
0 件のコメント
採用された回答
Bhuvanyu Dogra
2021 年 8 月 16 日
It is my understanding that you are looking for an alternative to the 'Fcn' block in the R2021a release.
The following documentation suggests the use of 'MATLAB Function' block instead of the 'Fcn' block in the R2021a release:
Please refer to the MATLAB Function Block documentation for more information on the usage of the block.
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!