Hello,
I'm new to Scilab and just want to create a simple 3 dimensional plot
with a surface or mesh. The data that I have are points with the
coordinates x,y,z.
I would like to import them into a matrix and let Scilab do the rest
with plot3d.
I read the documentation but I couldn't figure out the correct way how
to use the plot3d function.
Below I pasted my the script that I built so far. The import of the
point data works fine.
The x,y,z coordinates are stored in the matrix "nmatrix".
It would be awesome if someone would be willing to help!
Thanks,
Christian
function plot_it(filename)
fid = mopen(filename, 'r');
if (fid == -1)
error('read_words: cannot open file for reading');
end
counter=0;
done_yet=0;
while (done_yet == 0)
counter=counter+1;
[num_read, val(1), val(2), val(3)] = mfscanf(fid, "%f %f %f");
if (num_read <= 0)
done_yet = 1;
else
nmatrix(counter,1:3)=[val(1) val(2) val(3)];
mprintf("%f %f %f \n",nmatrix(counter,1:3));
end
end
mclose(fid);
//===================
// how can I make the 3d plot in this part of the script???
//===================
endfunction
Francis - 02 Jul 2009 17:02 GMT
Try:
plot3d(1:counter,1:3,nmatrix)
Francis - 02 Jul 2009 17:11 GMT
plot3d requires regular points. check the function: surf