MATLAB Answers

Filling symbolic arrays while setting zeros when filling these arrays since useless variables

1 view (last 30 days)
petit
petit on 20 Apr 2021
Commented: petit on 22 Apr 2021
Hello, below a code snippet to fill the symbolic matrixes FISH_BIG_GCsp and FISH_BIG_XC. Unfortunately, I am not filling entirely these 2 arrays and the execution takes a loo long time since I am taking into account unncessary symbolic values.
The ideal would be to have like I do for numerical arrays, that is to say, set zeros(31,31) and fill after the arrays with assignement : that allows me to not take into account (or at least simplify the execution time) the zeros.
But I don't know how to do the same it with symbolic arrays. If someone could help me, this would be fine
Here below the code snippet :
FISH_SYM = sym('xc_', [31,31], 'positive');
FISH_BIG_GCsp = sym('sp_', [31,31], 'positive');
FISH_BIG_XC = sym('xc_', [31,31], 'positive');
% Block bias spectro + pshot and correlations
FISH_BIG_GCsp(1:7,1:7) = FISH_GCsp_SYM(1:7,1:7)
FISH_BIG_GCsp(7:17,7:17) = FISH_GCsp_SYM(7:17,7:17)
FISH_BIG_GCsp(1:7,7:17) = FISH_GCsp_SYM(1:7,7:17)
FISH_BIG_GCsp(7:17,1:7) = FISH_GCsp_SYM(7:17,1:7)
% Block bias photo and correlations
FISH_BIG_XC(1:7,1:7) = FISH_XC_SYM(1:7,1:7)
FISH_BIG_XC(21:31,21:31) = FISH_XC_SYM(11:21,11:21)
FISH_BIG_XC(1:7,21:31) = FISH_XC_SYM(1:7,11:21)
FISH_BIG_XC(21:31,1:7) = FISH_XC_SYM(11:21,1:7)
% Block I.A and correlations
FISH_BIG_XC(18:20,18:20) = FISH_XC_SYM(8:10,8:10)
FISH_BIG_XC(1:7,18:20) = FISH_XC_SYM(1:7,8:10)
FISH_BIG_XC(18:20,1:7) = FISH_XC_SYM(8:10,1:7)
% Final summation
FISH_SYM = FISH_BIG_GCsp + FISH_BIG_XC
  3 Comments
petit
petit on 22 Apr 2021
error of beginner :
problem solved by simply FISH_BIG_Gcsp and FISH_BIG_XC to zeros "symbolic" arrays and after fill them with subarrays FISH_GCsp_SYM and FISH_XC_SYM

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!