Borrar filtros
Borrar filtros

plot a graph with 3 variables.

146 visualizaciones (últimos 30 días)
jose bernardo
jose bernardo el 5 de Feb. de 2014
Comentada: Jee Jap Haw el 22 de Jun. de 2019
I have this data on excel:
first column is temperature, and first row is voltage, the other data are seconds. How could I plot this table on matlab??? Because I only did plots with two variables and in this case i dont know.
Thanks for your attention.
  1 comentario
Jee Jap Haw
Jee Jap Haw el 22 de Jun. de 2019
Is it possible to obtain the equation of the plane ?

Iniciar sesión para comentar.

Respuesta aceptada

Ilham Hardy
Ilham Hardy el 5 de Feb. de 2014
It depends on which plot type do you want,
e.g.
mesh(x,y,z)
surf(x,y,z)
  2 comentarios
jose bernardo
jose bernardo el 5 de Feb. de 2014
Editada: jose bernardo el 5 de Feb. de 2014
And how I could read the data? I was trying with this:
[v1]=xlsread(['C:\excelfile.xlsx'],'a1:z10'); %% to read all data.
x=v1(:,1) %%% read the column of time
y=v1(1,:) %%% read the row of voltage
z=v1('b2','z10'); %%% read all the matrix of seconds.
But this message is shown "??? Index exceeds matrix dimensions."
where is the problem??? thanks
Ilham Hardy
Ilham Hardy el 5 de Feb. de 2014
Say the matrix is located in Excel file test.xlsx at field A1:H9
First, import value
impval = xlsread('test.xlsx','a1:h9');
since the matrix(1,1) {1st column, 1st row} is empty in the excel file matlab will put NaN during the data import see below
>> impval =
NaN 0.6000 0.6250 0.6500 0.6750 0.7000 0.7250 0.7500
25.0000 301.0000 310.0000 319.0000 328.0000 337.0000 346.0000 355.0000
45.0000 302.0000 312.0000 322.0000 332.0000 342.0000 352.0000 362.0000
65.0000 303.0000 314.0000 325.0000 336.0000 347.0000 358.0000 369.0000
85.0000 304.0000 316.0000 328.0000 340.0000 352.0000 364.0000 376.0000
105.0000 305.0000 318.0000 331.0000 344.0000 357.0000 370.0000 383.0000
125.0000 306.0000 320.0000 334.0000 348.0000 362.0000 376.0000 390.0000
145.0000 307.0000 322.0000 337.0000 352.0000 367.0000 382.0000 397.0000
165.0000 308.0000 324.0000 340.0000 356.0000 372.0000 388.0000 404.0000
divide the matrix into three seperate groups
time data
t_data = impval(2:end,1);
>> t_data =
25
45
65
85
105
125
145
165
voltage data
v_data = impval(1,2:end);
>> v_data =
0.6000 0.6250 0.6500 0.6750 0.7000 0.7250 0.7500
matrix data
m_data = impval(2:end,2:end);
>> m_data =
301 310 319 328 337 346 355
302 312 322 332 342 352 362
303 314 325 336 347 358 369
304 316 328 340 352 364 376
305 318 331 344 357 370 383
306 320 334 348 362 376 390
307 322 337 352 367 382 397
308 324 340 356 372 388 404
plot the data accordingly
figure(1)
mesh(v_data,t_data,m_data);
figure(2)
surf(v_data,t_data,m_data);

Iniciar sesión para comentar.

Más respuestas (1)

David Sanchez
David Sanchez el 5 de Feb. de 2014
Use plot3 command:
plot3(x,y,z)
Take a look at
doc plot3
or
help plot3

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by