I have a n x 3 matrix called dataMat. I also have n amount of processes that this code will eventually be able to handle. Each process has a n value (n), pressure (p) and volume (v). I want to be able to calculate the work done using 1 of two formulas-formula chosen based on if n=1 or not. My code is below, I don't know how to change the variable names while pulling data from the matrix at the same time.
n=size(dataMat,1);for i=1:n Cyc(i)n=dataMat(n,1); Cyc(i)p=dataMat(n,2); Cyc(i)v= dataMat(2,3);end
formulas: if n=1 W=(P1)(V1)ln(V2/V1)
if not W=(P2*V2-P1*V1)/1-n1
Best Answer