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 views (last 30 days)
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

Accepted Answer

Bhuvanyu Dogra
Bhuvanyu Dogra on 16 Aug 2021
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.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!