load('air.txt')Air.temp = air(:,1);Air.press = air(:,2);Air_R = 0.287;load('argon.txt')Argon.press = argon(:,2);Argon.temp = argon(:,1);Argon_R = 0.208;load('helium.txt')Helium.press = helium(:,2);Helium.temp = helium(:,1);Helium_R = 2.080;for k = 1:length(air) Air(k).vol = (Air_R*Air(k).temp)./Air(k).press;endfor k = 1:length(argon) Argon(k).vol = (Argon_R*Argon(k).temp)./Argon(k).press;endfor k = 1:length(helium) Helium(k).vol = (Helium_R*Helium(k).temp)./Helium(k).press;end
Using the ideal gas law to caululate the velocity of argon, helium and air, but I keep getting and Error.
"Index exceeds the number of array elements (1)."
When I run the code through I only get the volume of air butnot the volumes of argon or helium? I tried to also create a auser defined function, but I wasn't able to figure out what was wrong with that either.
Best Answer