How to find location of parameters in a genarized matrix
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I want to find the location of tunable parameters within a generalized matrix.
I want to make sure I don't miss parameters with values set to zero, so converting to double won't work.
Is this possible?
For example:
p = realp('p', 0);
A = genmat(zeros(5));
A(2,4) = p;
% now find the location of p in A
0 comentarios
Respuestas (1)
Ayush Aniket
el 28 de Oct. de 2024
There is no MATLAB function that would provide you the location of these tunable parameter within the generalized matrix. However, if the goal is to interact and change the value of these paramters, you can use the Blocks propoerties of the matrix. Refer to the following documentation link to read about the property:
If you need the location of the parameters, a hackish workaround is to use the usubs function to substitute the tunable parameters with unique identifiers and then identify their locations as shown below:
p = realp('p', 0);
A = genmat(zeros(5));
A(2,4) = p;
% Substitute the tunable parameter with a unique value
% This helps in identifying the location of the parameter
uniqueValue = 1; % Use a unique non-zero value
A_sub = usubs(A, 'p', uniqueValue);
% Find the location of the unique value
[row, col] = find(A_sub == uniqueValue);
0 comentarios
Ver también
Categorías
Más información sobre Portfolio Optimization and Asset Allocation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!