Contourslice error
Mostra commenti meno recenti
I keep getting the following error and I can't figure out why:
??? Error using ==> interp3 at 138 X, Y and Z must be matrices produced by MESHGRID. Use TriScatteredInterp instead of INTERP3 for scattered data.
Error in ==> contourslice at 124 vi = interp3(x, y, z, v, xi, yi, zi, method);
Error in ==> MagPlot at 21 contourslice(xg, yg, zg, maginterp,[],[],-0.4,20);
This is the associated script (x, y and z are vectors and mag is an array of several sets of data at x,y and z):
load('mag.mat'); coords=xlsread('NodeCoords.xls'); nodenum=coords(:,1); x=coords(:,2); z=coords(:,3); y=coords(:,4); clear coords
r=0:0.01:1; theta=0:pi/50:2*pi; zg=-0.45677:(-0.38877+0.45677)/9:-0.38877; [r,theta,zg]=meshgrid(r,theta,zg); xg=r.*cos(theta); yg=r.*sin(theta);
F=TriScatteredInterp(x,y,z,mag(:,1,700)); maginterp=F(xg,yg,zg); contourslice(xg, yg, zg, maginterp,[],[],-0.4,20);
1 Commento
Sean de Wolski
il 13 Set 2011
Good question (though you need to edit the code formatting)! +1 for being interesting.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Line Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!