extracting data from 4-D double
Ältere Kommentare anzeigen
I am trying to use ndgrid to calculate values for an optimization problem. I was able to successfully use the function for my equation but I am unable to find the optimal points or retrieve data from it at all. Only thing that hasn't returned an error is trying a feather graph ( which crashed my computer). Any help is much appreciated.
n=1:20;
[nFin, d ,L ,Aw] = ndgrid(n(:).^2,.001:.001:.05,.001:.001:.05,.01:.01:.5);
%corrected length eqn
Lc = L + d./4;
%area of fin
Af = (pi./4).*d.^2;
%perimeter of fin
P = pi.*d;
% fin convection term m
m = ((h.*P)./(k.*Af)).^0.5;
q = dT.*h.*(Aw-(Af.*nFin)) + dT.*nFin.*tanh(m.*Lc).*(h.*k.*P.*Af).^0.5 ;
5 Kommentare
Akira Agata
am 22 Mai 2017
The variables "h" and "k" are undefined in this program. What are these variables ?
jourdan joyner
am 22 Mai 2017
Akira Agata
am 22 Mai 2017
Thank you for your answer, but next "dT" is still undefined...
Akira Agata
am 22 Mai 2017
Thank you for providing a hole code. Then, let me clarify what exactly you would like to find (i.e. what 'optimal point' in your question means). If you want to find the minimum point of 4-D matrix 'a', then you can do as follows:
[val, idx] = min(a(:));
[i,j,k,h] = ind2sub(size(a), idx);
Then, the minimum value and it's index can be found to a(i,j,k,h) = val.
jourdan joyner
am 22 Mai 2017
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Problem-Based Optimization Setup finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!