[scilab-Users] Seeking help in plotting a function in Scilab.

Adrien Vogt-Schilb vogt at centre-cired.fr
Wed Dec 7 18:21:34 CET 2011


Dear Vikash

Scilab talking.

try to use plot3d(x,y,z), z being a matrix (as opposed to vector)

you can build from this working example:

x=(-10:0.13:10)';
t=(0:0.13:20)';
z=(sin((x*t') ./2).^2) ./ (x *x');
p=x *x';
clf, plot3d(x,t,z)

note the difference between element-wise operations and matricial 
operations like x*t'


On 07/12/2011 17:55, Vik@$h Dutt P at ndey wrote:
> Dear Scilab,
>
> I am Vikash Pandey, an Indian and presently pursuing PhD research in 
> Nonlinear and Quantum Optics at University of Malaya, Malaysia.
> I am a new user of Scilab but I really like this software which is 
> available for free and almost behaves like a substitute to the 
> expensive MatLab.
>
> I will really appreciate if you can help me in overcoming a 3D 
> plotting problem which I am facing in Scilab. I was trying to plot the 
> curve *[{sin(x*t/2)} / x]^2 *following the below mentioned set of 
> instructions.
>
>
> -->x=(-10:0.013:10);
> -->t=(0:0.013:20);
> -->m=(x .*t) ./2;
> -->p=x .*x;
> -->z=sin(m) .*sin(m);
> -->v=z ./p;
> -->clf, param3d(x,t,v)
>
> I had obtained the graph (see attached please) but *what I got was a 
> parametric 3D curve while I was expecting a plot of 3D 
> surface.* Besides, I had also tried plotting the function using 
> commands *fplot3d, plot3d and plot3d1 *but all of them ended up with 
> errors. I have attached two pictures in this email. One of them is the 
> parametric curve which I got and another is a 3D surface curve which I 
> was expecting.
>
> Can you please tell me where I am wrong ? How can I obtain the 
> expected 3D surface plot for the given function ?
>
> Please correct me if I am wrong.
>
> I will be thankful to you if I get to hear something from you on this.
>
> Thanks You!
> -- 
> *With Best Wishes...*
>
> *Vikash Pandey*
>
> *PhD Research Assistant,*
> *Dept. of Physics (Quantum and Laser Science Group),*
> *University of Malaya, Kuala Lumpur, *
> *50603, Malaysia*
>
> *Mobile Number: +91-898-759-9601 <tel:%2B91-898-759-9601>  [India]*
> *                                         +60-010-785-6758[Malaysia]*
> *e_mail:vikash4exploring at gmail.com <mailto:vikash4exploring at gmail.com>*
> *Skype: vikash4exploring*
>
>
>
>
>


-- 
Adrien Vogt-Schilb (Cired)
Tel: (+33) 1 43 94 *73 77*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20111207/8385c022/attachment.htm>


More information about the users mailing list