Plot 3D matrix
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
James
am 6 Nov. 2018
Kommentiert: madhan ravi
am 9 Nov. 2018
I have a 3D matrix containing values of potential between two charges for every x,y and z value so that I can find out the potential at any point by inputting three coordinates. The problem I'm having is I am unable to plot a 3D surface plot showing the potential.
I try and use surf() but the error says the value must be scalar, vector or numerical. I do have 2 inf values where the two charges lie, is this whats causing the problem and if so how do I get around it?
6 Kommentare
Jan
am 9 Nov. 2018
If you mention, that you get an error, please post a copy of the complete message. It is not possible that there is "another error", because Matlab stops at the first error already. "saying data dimensions dont agree" is less useful than a copy of the message, because then the readers do not have to guess in which line the error occurs.
Please post the relevant part of the code and a copy of the error message.
Akzeptierte Antwort
madhan ravi
am 9 Nov. 2018
Bearbeitet: madhan ravi
am 9 Nov. 2018
load matlab.mat
[X3,Y3] = meshgrid((-4.5:0.1:4.5),(-4.5:0.1:4.5));
for i = 1:81
figure()
surf(X3,Y3,d(:,:,i)) %likewise 1 to 81
end
4 Kommentare
madhan ravi
am 9 Nov. 2018
So there’s nothing wrong in it James because the data points vary in each page of d that’s why there is slight change nothing to worry about it
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots 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!