extracting data from 4-D double
显示 更早的评论
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 个评论
Akira Agata
2017-5-22
The variables "h" and "k" are undefined in this program. What are these variables ?
jourdan joyner
2017-5-22
Akira Agata
2017-5-22
Thank you for your answer, but next "dT" is still undefined...
Akira Agata
2017-5-22
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
2017-5-22
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Problem-Based Optimization Setup 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!