Help with Data Plotting - Surface Plot from known M-by-1 and N-by-1 matrices

2 views (last 30 days)
Hi All,
I have a physical quantity - Induced Voltage (V) as a function of two independent variables - Electric field (E) and Temperature (T). V is NOT known as a mathematical function of E and T, i.e. not in the form V = f(E,T) where the function f is known mathematically. But through certain numerical computations, I know how V varies with E and T (separately).
1.e. for E = 1:1:600, I know the corresponding V as a 600-by-1 vector (say V1), and with T = 1:1:200, I know the corresponding V as a 200-by-1 vector (say V2).
These two matrices V1 and v2 are arising from separate programs, but I've exported them and now, they are available as separate .dat files, which can be conveniently imported.
Separate plots for (V vs E) and (V vs T) are possible and I've realized them, my question is - is it possible to represent this using a surface plot, where E becomes the z-axis of the plot, and E and T are the X- and Y-axes respectively ?
Remember - (possible complications) - 1) The matrices have separate sizes - 200-by-1 and 600-by-1, so my x and y axes are ... varying to different extents. 2) Because there is no mathematical form, I know V only at 200 and 600 points respectively. (I am not averse to interpolation, but if that can be avoided, that would be preferable)
  1 Comment
Caroline Voloshin
Caroline Voloshin on 22 May 2013
Hey Sulimon,
Your example helped, but I'm thinking about an extension - when I load my data files into v1 and v2, and generate the surface plot with that command, what I got wasn't really a surface plot in the sense that I wanted. Maybe I didn't make my problem very clear. So, here it goes - Suppose I label my V = f(E, T). Then, by a surface plot, I mean that with V on the z-axis, and E and T on x and y respectively, and given that I have 200 points for T and 600 for E, if I imagine holding x=constant, say x = 20, and I move along the y-axis from 1 to 200 - then I get a curve which is (V =) z = f(20,T). This information I can obtain from the stored data that I have.
Next, if I set x = 40, and move from y = 1 to 200, I get a different curve z = f(40,T), which also I have stored in my data files. Now, I haven't generated the data for each and every one of these 600-into-200 combinations, but still, I have it for 600-into-5, i.e. for five fixed values of the temperature, I have 600 data points telling me what f(E,T) is, one for each value of E (and I've taken 600 values of E).
So, my question is - can these 5 curves of (600-into-1) points be plotted in that surface plot, to make it look like a continuous surface ?
What your example code is doing is, as per my above description, what should've been the different f(20,T) and f(40,T), is actually coming out to be the same curve. Of course, I didn't make myself clearer.
Thanks for your kind help.

Sign in to comment.

Accepted Answer

Sulimon Sattari
Sulimon Sattari on 21 May 2013
Yes, you can but. You must use your two data sets to create a 200X600 matrix, and do a surface with T, E, and the 200X600 matrix. meshgrid is very useful for this. Here's an example:
T = 1:200;
V1 = rand(1,200);
V2 = rand(1, 600);
surf(T,E, meshgrid(V1,V2));
  1 Comment
Caroline Voloshin
Caroline Voloshin on 21 May 2013
Thank you so much. I can build on your example. So, this serves my purpose.
Thank you once again.

Sign in to comment.

More Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!