Window not accommodate my formulated analytical equations (Qy), it might go thousands, probably due to coded through sprintf; any assistance please
2 views (last 30 days)
Show older comments
my code need alot of data to nonlinear equation,
function [FUN] = magige222(matr)
matL=abs(matr); [NodLp,pQ]=size(matr); data1=3; data2=data1+2-1; Nod3=NodLp-data1; p=pQ-1; nodes=9; LP=Nod3-nodes; JJ=NodLp-8+1; HLD=0; % matr loop eqns; not general matrix (MAG)
FUN = 'FUN=@(Qy)[';
for j=JJ:NodLp % looping headloses eqns
for k=1:p
if (sum(matL(j,1:k))<=sum(matL(j,1:p)))&&matL(j,k)~=0 FUN = [FUN, sprintf('(%d.*Qy(%d).*abs(Qy(%d)*8.*L(1,%d)*1./(9.81*3.14.^2.*D(1,%d).^5).*(0.25.*(log10(ee./(3.7.*D(1,%d))+2.51*3.14*vs.*D(1,%d)./(4.*Qy(%d)).*(0.25.*(log10(ee./(3.7.*D(1,%d))+2.51*3.14*vs.*D(1,%d)./(4.*Qy(%d)).*(0.25.*(log10(ee./(3.7.*D(1,%d))+2.51*3.14*vs.*D(1,%d)./(4.*Qy(%d)).*0.00001.^-0.5)).^-2).^-0.5)).^-2).^-0.5)).^-2)))+',matr(j,k),k,k,k,k,k,k,k,k,k,k,k,k,k)]; end
if (k==p) FUN = [FUN, sprintf('(%d);',matr(j,k+1))]; end
end
end
for j=data2:NodLp-8 % Nodal mass balance eqns
for k=1:p
if (sum(matL(j,1:k))<=sum(matL(j,1:p)))&&(matL(j,k)~=0) FUN = [FUN, sprintf('(%d.*Qy(%d))+',matr(j,k),k)]; end
if (k==p) FUN = [FUN, sprintf('(%d);',matr(j,k+1))]; end % FUN = [FUN, sprintf('matr(j,k+1);',j,k)]; end
end
end
FUN = [FUN, '(1.*Qy(1))+(-1.*Qy(2))+(0);(1.*Qy(2))+(-1.*Qy(3))+(-1.*Qy(9))+(-1.*Qy(15))+(-5.900000e-02);(1.*Qy(3))+(-1.*Qy(4))+(-1.*Qy(8))+(-5.900000e-02);(1.*Qy(4))+(1.*Qy(5))+(-1.*Qy(7))+(-1.780000e-01);(-1.*Qy(5))+(1.*Qy(6))+(-1.*Qy(11))+(-1.*Qy(12))+(-5.900000e-02);(1.*Qy(7))+(-1.*Qy(10))+(1.*Qy(11))+(-1.*Qy(13))+(-1.900000e-01);(1.*Qy(8))+(1.*Qy(9))+(1.*Qy(10))+(-1.*Qy(14))+(-1.780000e-01);(1.*Qy(14))+(1.*Qy(20))+(1.*Qy(21))+(-9.100000e-02);(1.*Qy(16))+(1.*Qy(19))+(-1.*Qy(20))+(0);(1.*Qy(15))+(-1.*Qy(16))+(1.*Qy(17))+(0);(1.*Qy(17))+(-1.*Qy(18))+(-3.000000e-02);(1.*Qy(18))+(-1.*Qy(19))+(-3.000000e-02);(1.*Qy(12))+(1.*Qy(13))+(-1.*Qy(21))+(0)];'];
end
the output those I got as executed the code
8.*L(1,70)*1./(9.81*3.14.^2.*D(1,70).^5).*(0.25.*(log... Output truncated. Text exceeds maximum line length for Command Window display.
Answers (0)
See Also
Categories
Find more on Oceanography and Hydrology in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!