How to find minimum of a 3D function in a double for loop plotted on a slice?
    8 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Wiqas Ahmad
 am 20 Apr. 2022
  
    
    
    
    
    Kommentiert: Wiqas Ahmad
 am 20 Apr. 2022
            I have 24 subplots of a 3D function (costf) plotted on a slice using two forloops,h and fov, as:

The program is:
figure
count = 1;
for h = 1000:1000:4000
    for fov = [0.2, 0.5, 1, 2, 5, 10]       
        H = genHeight(h);
        a = 0.01:0.01:0.05;
        r = 4:20;
        [X, Y, Z] = meshgrid(r, a, H);
        xslice = r;
        yslice = a;
        zslice = H;
        subplot(6, 4, count) 
        slice(X, Y, Z,costf, xslice, yslice, zslice)
        shading interp   
        hCB=colorbar
        hCB.Label.String='Cost function';
        xlabel('CER_{ref}(\mum)')
        ylabel('\alpha_{ref}(1/m)')
        xlim([4, 20])
        zlabel('Height(m)')
        view([-221.831289102975 32.404205593246]);
        count = count + 1;
    end
end
I want to find the minimum value of the function "costf" in each loop, alternatively in each subplot and spot the minimum value in each subplot with asterisk. My cost function is a 3d function with dimensions, as:

0 Kommentare
Akzeptierte Antwort
  Matt J
      
      
 am 20 Apr. 2022
        
      Bearbeitet: Matt J
      
      
 am 20 Apr. 2022
  
      figure
count = 1;
for h = 1000:1000:4000
    for fov = [0.2, 0.5, 1, 2, 5, 10]       
        ....
        tf=costf==min(costf(:));
        hold on
        scatter3(X(tf),Y(tf),Z(tf),'*')
        hold off
    end
end
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Graphics Performance finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





