Hello, I have a function, and I can calculate P from the command window, but when I use this function, my output yh has P(1), P(2), etc, but what I want it do to is replace those with the actual value calculated
function yh = BreakRod(cellData)Y = cellData{1,:}';U = cellData{2,:}';V = cellData{3,:}';A = Adef(U,V);P = A\Y;yh = @(U,V) P(1) + P(2)*exp(U.^2) + P(3)*sqrt(V) + P(4)*U.*V;endfunction A = Adef(U,V)N = size(U,1);A = ones(N,4);A(:,2) = exp(U.^2);A(:,3) = sqrt(V);A(:,4) = U.*V;endcellData{:}ans = 1 4 5 6ans = 1.0000 2.0000 3.0000 0.5000ans = 2 1 7 3PP = 30.4842 0.0299 -3.4979 -12.3093yh = BreakRod(cellData)yh = @(U,V)P(1)+P(2)*exp(U.^2)+P(3)*sqrt(V)+P(4)*U.*V
Best Answer