[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Plot using surf/mesh command in GNU octave
From: |
Ben Abbott |
Subject: |
Re: Plot using surf/mesh command in GNU octave |
Date: |
Thu, 15 Aug 2013 08:22:36 -0400 |
On Aug 15, 2013, at 7:16 AM, Sarah wrote:
> I want to plot a 3D plane in GNU Octave using the surf/mesh command.
>
> I have following data e.g
>
> a= [ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 2 3 4 5 6 7 8 9 10 11 12 13
> 14 15 16 17];
>
> b= [ 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001
> 0.001 0.001 0.001 0.001 0.001 0.011 0.011 0.011 0.011 0.011 0.011 0.011
> 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011 0.011];
>
> c= [ -0.88 -8.87 -0.86 -0.82 -0.77 -0.71 -0.66 -0.62 -0.57 -0.54 -0.50 -0.47
> -0.44 -0.42 -0.39 -0.377 -0.36 -0.89 -0.88 -0.85 -0.81 -0.76 -0.71 -0.66
> -0.61 -0.57 -0.53 -0.50 -0.47 -0.44 -0.42 -0.39 -0.37 -0.36];
>
> I could plot it using plot3 command..
>
> But how should I plot it by using surf/mesh command in GNU Octave?
a= [ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17];
b= [ 0.001 0.001 0.001 0.001 0.001 0.001 ...
0.001 0.001 0.001 0.001 0.001 0.001 ...
0.001 0.001 0.001 0.001 0.001 0.011 ...
0.011 0.011 0.011 0.011 0.011 0.011 ...
0.011 0.011 0.011 0.011 0.011 0.011 ...
0.011 0.011 0.011 0.011];
c= [ -0.88 -8.87 -0.86 -0.82 -0.77 -0.71 ...
-0.66 -0.62 -0.57 -0.54 -0.50 -0.47 ...
-0.44 -0.42 -0.39 -0.377 -0.36 -0.89 ...
-0.88 -0.85 -0.81 -0.76 -0.71 -0.66 ...
-0.61 -0.57 -0.53 -0.50 -0.47 -0.44 ...
-0.42 -0.39 -0.37 -0.36];
[x, y, z] = griddata (a, b, c, unique (a), unique (b)');
surf (x, y z)
Ben