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.

1 次查看(过去 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

采纳的回答

Bhuvanyu Dogra
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 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by