Fitting 3-d plot
    19 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Tim Fulcher
 il 27 Ago 2023
  
    
    
    
    
    Commentato: Tim Fulcher
 il 27 Ago 2023
            Hi all,
I've been plotting a surface plot using surf(x, y, z) where x is a 1 x  8 double, y is a 1 x 11 double and z is an 11 x 8 double and fitting that surface using cftool with no issues. I now need to change my approach slightly and perform the fit programatically (as opposed to using cftool). 
However surffit = fit([x,y],z,'poly32','normalize','on') does not accept my current format. How I can I adjust or massage my raw data (x, y and z) for surffit to accept it?
Thanks
0 Commenti
Risposta accettata
  the cyclist
      
      
 il 27 Ago 2023
        x = 1:8;
y = 1:11;
z = rand(11,8);
[xx,yy] = meshgrid(x,y);
surf(xx,yy,z)
3 Commenti
  the cyclist
      
      
 il 27 Ago 2023
				Sorry, I should have mentioned that the surface fitting function requires you to turn all those matrices into vector again. The key concept being that all the vectors need to be the same length, and specify a series of (x,y,z) coordinates.
You should double-check that my syntax really put the correct z with the corresponding (x,y). It's easy to get the (x,y) swapped.
x = 1:8;
y = 1:11;
z = rand(11,8);
[xx,yy] = meshgrid(x,y);
surf(xx,yy,z)
surffit = fit([xx(:), yy(:)], z(:), 'poly32', 'normalize', 'on')
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Surface and Mesh Plots in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



