How do you make a 3D plot with the given information?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Use the same “patient_data.txt” file used earlier, write a Matlab program to produce a 3D plot of the patient data. The three coordinates of the plot should be the age, heart rate and blood pressure of the patients, and the smokers and non-smokers should be displayed using different symbols on the same plot. Annotate your figure appropriately by, for example, inserting suitable labels on the axes. The first column states wheither the patient is a smoker, the second is their age, the third is their heart rate and the fourth is their blood pressure.
Y 48 98 111
N 33 73 97
N 65 97 124
N 73 93 128
Y 21 74 113
N 28 62 100
Y 39 80 133
N 41 75 128
Y 74 100 147
Y 58 79 130
Y 40 70 121
N 41 68 107
Y 62 97 136
N 21 63 97
N 61 80 111
Y 49 85 138
N 52 83 138
Y 71 99 140
Y 50 74 121
Y 43 78 130
N 49 69 105
Y 65 103 140
N 27 69 96
N 67 82 118
0 comentarios
Respuestas (1)
Naman Bhaia
el 27 de Feb. de 2019
Editada: Naman Bhaia
el 27 de Feb. de 2019
Hey Abigail,
What I understood is that you want to make a 3d plot from the second, third and fourth column of the data given. For that you can first read the table into a text file using the readtable() function as follows:
T=readtable('temp.txt')
Then after this you can plot the three variables using the plot3() function in the following two ways:
1. Use the table variables as it is:
plot3(T.Var2,T.Var3,T.Var4)
2. Convert the table variables to an array by using the table2array() function then use them to plot your graph
A=table2array(T(:,2:4))
plot3(A(:,1),A(:,2),A(:,3))
0 comentarios
Ver también
Categorías
Más información sobre Annotations 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!