I want to create a simulink model which takes two input parameters alpha1 and Rb1 and gives output zcal.

zcal is output which depends on frequency dependent variables zn and zm. My code requires reading excel files. How can I use my matlab code in simulink environment? I am trying Embedded Matlab function block but getting lot of errors, like subscripting into an mxArray is not supported etc. My code looks like this:
clear all; clc;
A= xlsread('500.xlsx');
B= xlsread('fzpcT.xlsx');
f= A(1:167,1);
zm1= -(j)./(1*pi*f*(8.92e-8));
zm= (zm1.*0.0005);
zn= A(1:167,2).*(0.0005);
zc= B(1:167,2);
rc= 10e-6;
rho= 1/(2.195);
zsin= abs(1./(zm+zn));
inzs= abs((1./zn)+(1./zm));
zs= abs(zm+zn);
zc= B(1:167,2);
zzp= abs(zn.*zs);
zmp= abs(zm./zzp);
gmarc=alpha1*sqrt(inzs);
zcal= 1./(zsin+(zmp./(((0.5*gmarc).*((besseli(0,gmarc))./(besseli(0,gmarc))))+(Rb1.*inzs))));
figure();
loglog(f,zc,'b',f,zcal./0.0005,'r',f,zn./0.0005,'k');
end
Please tell me how can I put my code to use in Embedded MatLab function of simulink? Thanks in advance.

Réponses (0)

Cette question est clôturée.

Clôturé :

le 20 Août 2021

Community Treasure Hunt

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

Start Hunting!

Translated by