Vector of structures for parameter sensitivity analysis

1 view (last 30 days)
Hello everybody,
I implemented the equations of a simple model. These equations use the variables stored in structures. I would like to use a vector of structures where each element of the vector contains the variables (organized in structures) of a design under consideration.
For instance, for a design I have as variables:
DSN.group1.a = 5/1000;
DSN.group1.b = 10/1000;
and the equation I am evaluating are:
DSN.group2.res1 = DSN.group1.a + DSN.group1.b;
DSN.group2.res2 = DSN.group1.a * DSN.group1.b;
So far so good. Now, I would like to make a parameter sensitivity analysis with respect to parameter DSN.a using the variable parA, so I do:
NcasesA = 3;
parA = linspace(50,200,NcasesA)/1000;
countExt =1;
for count=1:NcasesA
DSNspace.DSN(countExt) = fun_evalDSN(parA(countExt)) ;
countExt=countExt+1;
end
where:
function DSN = fun_evalDSN(parA)
DSN.group1.a = parA;
DSN.group1.b = 10/1000;
DSN.group2.res1 = DSN.group1.a + DSN.group1.b;
DSN.group2.res2 = DSN.group1.a * DSN.group1.b;
end
Which is working correctly.
Consider the case where I have more variables to vary (not only DSN.a but also DSN.b and other), I would like in the end to plot a scatter plot of DSN.res1 vs DSN.res2.
The problem is that none of the following commands work:
scatter(DSNspace.DSN.group2.res1,DSNspace.DSN.group2.res2)
or
scatter([DSNspace.DSN.group2.res1],[DSNspace.DSN.group2.res2])
Error message:
"Expected one output from a curly brace or dot indexing expression, but there were 3 results."
Could you please help me? Do you have any recommendation or suggestion about how to handle my variables?
Thanks in advance
Andrea

Answers (0)

Categories

Find more on Variables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!