Hi, this is a formula for m linear equations where I need to solve for P where P is a vector of m values. Its written here in loop form and I've vectorised it below to solve in matlab
SIRtarget and eta are scalar values
U is an n*1 column
G and X are n*m matrices
P is a row of length m
SIRtarget.*A - SIRtarget.*P' + SIRtarget.*eta - P'
Vectorised for matlab as(split onto 5 lines for readability):
Problem is I cant figure out how to extract P from the vectorised formula to pass the linear equations to linsolve(Matlab). It needs to be vectorised as P could be up to 50 or 60 values long. G and X will typically be 400 rows X 50 or 60 columns.
Original formula attached as jpg
Any help much appreciated