i am a beginner in matlab and was trying to plot a function needed for a exercise.
i am using a loop to calculate the value of the variable p1 for 10 times. the code calculates and displays the value but i also want to get the plot of p1 w.r.t number of iterations(i.e. i)
Thank you in advance for the help.
clc; clear all; close all; % pressure decrease rate
p1 = 1000000; % starting pressure in the tank 10 bars equivalent in pascals
V = 0.0055; % volume of the tank 5 liters in m^3
M = 0.022897; % molar mass of air in kilograms
R = 8.3144598; %gas constant
T = 298.15; % environment temperature
m1 = 0;v= 0.112e-3;for i = 1:1:10m = (M*V*p1)/(R*T);m1 = (M*v*p1)/(R*T);p1 = (R*T*(m-m1))/(V*M)endplot(i, p1)
Best Answer