MATLAB %You need 3 for loops matlab code please [Submit on zyLabs] Write a funct
ID: 3719703 • Letter: M
Question
MATLAB
%You need 3 for loops
matlab code please
[Submit on zyLabs] Write a function that takes three inputs, an array of pressure values P, an array of temperature values T, and an array for different numbers of moles of gas N to create a pressure/temperature/volume plot for. Your function should return a cell array with N elements. Each element in the cell should be a length(P) x length(T) matrix, where each element is the volume for the given pressure, temperature, and number of moles (Number of Moles) R T(O) Note that the Number of Moles is the current index of N. R is the gas constant 8.314 J/mol KExplanation / Answer
PLEASE REFER BELOW CODE
function V = Volume_gas(P,T,array_mole)
R = 8.314;
for k = 1:length(array_mole)%array from 1 to N
for i = 1:length(P)
for j = 1:length(T)
V{k} = (array_mole(k) * R * T(j)) / P(i); %create cell array of each element as length(P) * length(T)
end
end
end
end
I DON'T HAVE INPUT PARAMETERS. PLEASE CALL THIS FUNCTION WITH REQUIRED PARAMETER AND LET ME KNOW THE RESULTS
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.