I want to get a 3-d plot in Matlab, looking like the surf function. The drawback is that they are 3 vectors, which basically have random numbers. The vector is also around 7500 numbers long, so to make a matrix with all numbers will exceed the memory significantly. The x-values are within -0.12 to -0.05, the y-values are within 0.085 to 0.13 and the z-values are within 28 to 48.(adsbygoogle = window.adsbygoogle || []).push({});

I have tried sortrows and reshape to try to make matrices, but the surf plot looks odd when I do. I have also tried to use gridfit, but I don't know if I'm using it wrong, because it becomes a bent line. Using plot3, I get to see how I want it to look, like a mountain with two peaks. I would be satisfied with that unless it was for the colors in surf, which I can not add to plot3. I still think gridfit is the solution I'll try to use, but I hope someone can tell me what I need to change with the code, or if I should use some other code.

The current code I'm trying is:

xnodes=-0.13:0.0005:-0.085;

ynodes=0:0.0005:0.5;

figure(54);

clf;

[XCA,YCA,IMA]=gridfit(XC,YC,IM,xnodes,ynodes);

surf(XCA,YCA,IMA)

where XC,YC and IM are my x,y and z-vectors I have.

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# 3-D plot using 3 vectors in Matlab

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**