"Data must be a single input of y-values or one or more pairs of x- and y-values" is the error I am getting. I want a 3d plot with V as the X-axis, T as the Y-axis, and P as the Z-axis.
clc
clear
R = 8.31;
T = linspace(273, 473);
V = linspace(0.0005, 0.002, 100);
n = 1;
P = zeros(0, 100);
for i = 1:length(T)
P(i) = (n.*R.*T(i))./(V(i));
n = n+1;
end
plot(V, T, P)
xlabel('Volume (m^3)')
ylabel('Temp (K)')
zlabel('Variant of Pressure (Pa)')
title('Ideal Gas Law')

 채택된 답변

KSSV
KSSV 2020년 9월 10일

0 개 추천

R = 8.31;
T = linspace(273, 473);
V = linspace(0.5*10^(-3), 2*10^(-3), 100);
n = 1:length(T);
N = repmat(n,length(T),1) ;
[V,T] = meshgrid(V,T) ;
P = (n.*R*T)./V;
surf(V,T,P)
shading interp ;
colorbar
OR
R = 8.31;
T = linspace(273, 473);
V = linspace(0.5*10^(-3), 2*10^(-3), 100);
n = 1;
P = zeros(0, 100);
for i = 1:length(T)
P(i) = (n.*R.*T(i))./(V(i));
n = n+1;
end
plot3(V, T, P)
xlabel('Volume (m^3)')
ylabel('Temp (K)')
zlabel('Variant of Pressure (Pa)')
title('Ideal Gas Law')

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

태그

질문:

2020년 9월 10일

답변:

2020년 9월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by