I'm trying to create a for loop that will assign a solved element of a function to a blank vector for every value of a given vector. However, when I try to run this code it gives "Error: Assignment has more non-singleton rhs dimensions than non-singleton subscripts" and stops on about the 44th value or so. I made the two vectors the same dimensions, so why am I getting dimensional errors?
syms T VTtp = 89.4% function from earlier
PRfxn = matlabFunction(PREos)% will use later
dPdV = diff(PREos, V)dPdT = diff(PREos, T)CpMinusCv = (-T*(dPdT)^2)/dPdVCpCvfxn = matlabFunction(CpMinusCv)% trying to get my T and V for a given P == Pc (variable defined earlier) variable Tc is also defined earlier
Trange = [Ttp:10:2.5*Tc]Vrange = zeros(1, length(Trange))i = 1;for T = Trange Vrange(1, i) = vpasolve(PRfxn(Trange(1, i), V) == Pc, V, [0 inf]) i = i+1;end
Best Answer