How to declare constants and vector as argument for once to use it in multiple functions
Dear all;
In my matlab code i have a parent code called "Main SDM". This code call child function "Child WSO" several time and then this child code call its child "single_dd" several time (about 100 times) which in its place call a child function "Ipv_newton" 3000 time!
The problem is that the two last functions are time consuming since it call each time their and constants and vectors
I want to global this constants and vectors or call it for once in Main SDM: ( Im,V, K,q, T, VT_stc) using input argument till the last function!
How it is possible to do it in multi stage (declare variable in main code and than use input argument for first function and continue until last function !)
Is it possible to do so, If not, what is the best way for my code’s performance
function J = single_dd(X)
global V Ie Im
J1=0;
Im=[0.7645 ……………………………….0.212 0.1035 -0.01 -0.123 -0.21];
V=[-0.2057 -0.1291 -0.0588 ………………. 0.5521 0.5633 0.5736 0.5833 0.59];
function x=Ipv_newton(X,v,x0)
k=1.38064852e-23;
q=1.60217646e-19;
T=33+273.15;
Vt_stc=k*T/q;
Main SDM call Child WSO which call single_dd which call Ipv_newtonDear all;
In my matlab code i have a parent code called "Main SDM". This code call child function "Child WSO" several time and then this child code call its child "single_dd" several time (about 100 times) which in its place call a child function "Ipv_newton" 3000 time!
The problem is that the two last functions are time consuming since it call each time their and constants and vectors
I want to global this constants and vectors or call it for once in Main SDM: ( Im,V, K,q, T, VT_stc) using input argument till the last function!
How it is possible to do it in multi stage (declare variable in main code and than use input argument for first function and continue until last function !)
Is it possible to do so, If not, what is the best way for my code’s performance
function J = single_dd(X)
global V Ie Im
J1=0;
Im=[0.7645 ……………………………….0.212 0.1035 -0.01 -0.123 -0.21];
V=[-0.2057 -0.1291 -0.0588 ………………. 0.5521 0.5633 0.5736 0.5833 0.59];
function x=Ipv_newton(X,v,x0)
k=1.38064852e-23;
q=1.60217646e-19;
T=33+273.15;
Vt_stc=k*T/q;
Main SDM call Child WSO which call single_dd which call Ipv_newton Dear all;
In my matlab code i have a parent code called "Main SDM". This code call child function "Child WSO" several time and then this child code call its child "single_dd" several time (about 100 times) which in its place call a child function "Ipv_newton" 3000 time!
The problem is that the two last functions are time consuming since it call each time their and constants and vectors
I want to global this constants and vectors or call it for once in Main SDM: ( Im,V, K,q, T, VT_stc) using input argument till the last function!
How it is possible to do it in multi stage (declare variable in main code and than use input argument for first function and continue until last function !)
Is it possible to do so, If not, what is the best way for my code’s performance
function J = single_dd(X)
global V Ie Im
J1=0;
Im=[0.7645 ……………………………….0.212 0.1035 -0.01 -0.123 -0.21];
V=[-0.2057 -0.1291 -0.0588 ………………. 0.5521 0.5633 0.5736 0.5833 0.59];
function x=Ipv_newton(X,v,x0)
k=1.38064852e-23;
q=1.60217646e-19;
T=33+273.15;
Vt_stc=k*T/q;
Main SDM call Child WSO which call single_dd which call Ipv_newton performance, profiler, function, global variables, input argument, vector MATLAB Answers — New Questions