Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Mathematics
General TopicsResearchOperations ResearchStatisticsMathematical LogicNumerical AnalysisUndergraduate MathAlgebra HelpRecreational Math
Math Software
MapleMathematicaMATLABScilabSASSPSS

Math Forum / Math Software / Scilab / July 2009



Tip: Looking for answers? Try searching our database.

How to create a simple plot3d with given point coordinates in a file?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vyrock - 02 Jul 2009 15:59 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.