data = importdata('data.txt') ;
x = data(:,1) ; y = data(:,2) ; z = data(:,3) ;
dt = delaunayTriangulation(x,y) ;
tri = dt.ConnectivityList ;
xi = dt.Points(:,1) ;
yi = dt.Points(:,2) ;
F = scatteredInterpolant(x,y,z);
zi = F(xi,yi) ;
trisurf(tri,xi,yi,zi)
view(2)
shading interp Answer from KSSV on mathworks.com
MathWorks
mathworks.com › matlabcentral › answers › 373888-plot-surface-with-3-vectors-x-y-z
Plot surface with 3 vectors x,y,z? - MATLAB Answers - MATLAB Central
December 20, 2017 - I have 3 vectors with a few 1000 measurement points. How do I 3D plot this data where x is on the x-axis and so on? I tried comet3 and surf but can't figure it out. Played a little with meshgrid but dont think its what I want. I need to plot data were I can see that when x was 10 that y and z were some values. Sign in to comment. Sign in to answer this question. ... https://www.mathworks.com/matlabcentral/answers/373888-plot-surface-with-3-vectors-x-y-z#answer_297960
MathWorks
mathworks.com › matlab › graphics › 2-d and 3-d plots › line plots
plot3 - 3-D line plot - MATLAB
Plot all three sets of coordinates on the same set of axes. ... Create vectors xt, yt, and zt.
Videos
MathWorks
mathworks.com › matlabcentral › answers › 590290-using-plot3-to-plot-3d-vectors
Using plot3 to plot 3d vectors - MATLAB Answers - MATLAB Central
September 7, 2020 - The following code is meant to plot the vectors (4,5,6), (-3,6,-3) and (1,2,3) directed from the origin. plot3([0 4], [0 5], [0 6], 'k^--',[0 -3], [0 6], [0 -3], 'b^--', [0 1],... [0 2],[0 3],...
MathWorks
mathworks.com › matlabcentral › answers › 124195-3d-plot-of-3-vectors
3D plot of 3 vectors - MATLAB Answers - MATLAB Central
April 2, 2014 - https://www.mathworks.com/matlabcentral/answers/124195-3d-plot-of-3-vectors#comment_206119 · Cancel Copy to Clipboard · Thank you for your swift answer.It is not going to work I tried it. Let me explain what are my matrices. the time values are approximately 50o in length. I did my measurements with 3 different inductances and the current values vary in length.
MathWorks
mathworks.com › matlab › graphics › 2-d and 3-d plots › vector fields
quiver3 - 3-D quiver or vector plot - MATLAB
To create a 3-D quiver plot using cylindrical or spherical coordinates, first convert them to Cartesian coordinates using the pol2cart or sph2cart function. ... This function accepts GPU arrays, but does not run on a GPU. For more information, see Run MATLAB Functions on a GPU (Parallel Computing ...
Top answer 1 of 6
26
a = [2 3 5];
b = [1 1 0];
c = a+b;
starts = zeros(3,3);
ends = [a;b;c];
quiver3(starts(:,1), starts(:,2), starts(:,3), ends(:,1), ends(:,2), ends(:,3))
axis equal
2 of 6
16
I agree with Aamir that the submission arrow.m from Erik Johnson on the MathWorks File Exchange is a very nice option. You can use it to illustrate the different methods of vector addition like so:
Tip-to-tail method:
o = [0 0 0]; %# Origin a = [2 3 5]; %# Vector 1 b = [1 1 0]; %# Vector 2 c = a+b; %# Resultant arrowStarts = [o; a; o]; %# Starting points for arrows arrowEnds = [a; c; c]; %# Ending points for arrows arrow(arrowStarts,arrowEnds); %# Plot arrowsParallelogram method:
o = [0 0 0]; %# Origin a = [2 3 5]; %# Vector 1 b = [1 1 0]; %# Vector 2 c = a+b; %# Resultant arrowStarts = [o; o; o]; %# Starting points for arrows arrowEnds = [a; b; c]; %# Ending points for arrows arrow(arrowStarts,arrowEnds); %# Plot arrows hold on; lineX = [a(1) b(1); c(1) c(1)]; %# X data for lines lineY = [a(2) b(2); c(2) c(2)]; %# Y data for lines lineZ = [a(3) b(3); c(3) c(3)]; %# Z data for lines line(lineX,lineY,lineZ,'Color','k','LineStyle',':'); %# Plot lines
MathWorks
mathworks.com › matlabcentral › answers › 1950523-how-to-create-a-surface-plot-having-3-vectors
How to create a surface plot having 3 vectors? - MATLAB Answers - MATLAB Central
April 20, 2023 - But without any kind of intelligence to guide it, surf can do nothing more than give up. It is you who needs to first decide what is the connectivity of those points, and then form it into something that surf is designed to handle. The onus is on you here, the user. ... https://www.mathworks.com/matlabcentral/answers/1950523-how-to-create-a-surface-plot-having-3-vectors#comment_3162646
Top answer 1 of 3
2
As conventional methods seem to fail, I would suggest you to do it manually.
- Create a
Zmatrix full ofNaNvalues. The size of the matrix should be dependant on yourxandyvalues. - Loop over all occuring
x,y, pairs and put their (average?)zvalue in the right position of yourZmatrix. - Loop over all
NaNvalues and interpolate their value. Perhaps usingfilter2. - Use
surfto plot the resulting surface
2 of 3
2
If you have points which are described by vectors, and you want to plot them you could always use a Delauny triangulation. The function in matlab is called Tri=delauny(X,Y,Z). The data generated by this function can be shown with either trimesh(Tri,X,Y,Z) or trisurf(Tri,X,Y,Z). Keep in mind trisurf is only for 3D data. If you want to adjust the transparancy of plots in your graph use the alpha setting.
I hope this helps
MathWorks
mathworks.com › matlabcentral › answers › 183288-3d-surface-plots-from-3-vectors
3D surface plots from 3 vectors? - MATLAB Answers - MATLAB Central
March 15, 2015 - I have 3 vectors. v1, v2, and v3. All are vectors with n number of elements in them. How to draw a surface plot. Matlab asking to make the Z axis a square matrix. Is there a way to represent the v3 matrix in matrix form? So we can create the Z bus matrix ad use 'surf' command? Sign in to comment. Sign in to answer this question. ... https://www.mathworks.com/matlabcentral/answers/183288-3d-surface-plots-from-3-vectors#answer_171439
MathWorks
mathworks.com › matlab mobile › matlab mobile fundamentals
Creating 3-D Plots - MATLAB & Simulink
This example shows how to create 3-D line plots in MATLAB using the plot3 function. Create a regularly-spaced vector t from 0 to 10*pi using pi/50 as the increment between elements.
MathWorks
mathworks.com › matlabcentral › answers › 30838-simple-3d-vector-plotting
Simple 3D vector plotting - MATLAB Answers - MATLAB Central
March 1, 2012 - The x, y, and z inputs represent where you want the base of the vector to be drawn and the u, v, and w inputs represent the three components of the vector. For drawing straight lines and arcs use line. See the documentation for examples of how to use it. For adding labels use text. Again, the documentation has useful examples. ... How can I draw a single 3d vector.
Carnegie Mellon University
andrew.cmu.edu › user › yuchingw › 3dplot.pdf pdf
3D Graphics in MATLAB We'll introduce different types of plotting in 3D.
We'll introduce different types of plotting in 3D. MATLAB has different plotting approaches for showing data in ... PLOT3() is a three-dimensional analogue of PLOT(). PLOT3(x,y,z), where x, y and z are three vectors of the same · length, plots a line in 3-space through the points whose
MathWorks
mathworks.com › matlabcentral › fileexchange › 29490-plot-3d-vectors
Plot 3d vectors - File Exchange - MATLAB Central
November 22, 2010 - h=vector3d(...,'LightDirection',[x y z]) : Adds a infinite light to the axes with specified position [x y z] ... [X,Y,Z]=sphere(20); [U,V,W] = surfnorm(X,Y,Z); surf(X,Y,Z); hold on h=vector3d(X,Y,Z,U,V,W,'FileName','arrow2.stl','Scale',0.25,'Lighting',... 'gouraud','ColorMap','jet','LightDirection',[-1 -1 1]) Pirmin Borer (2026). Plot 3d vectors (https://www.mathworks.com/matlabcentral/fileexchange/29490-plot-3d-vectors), MATLAB Central File Exchange.
