Window not accommodate my formulated analytical equations (Qy), it might go thousands, probably due to coded through sprintf; any assistance please

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.

댓글 수: 5

expected output is
FUN=[FUN, "......
as well assisted by Walter in few day ago
Thanks
I don't understand your question and I don't understand why on earth you are creating a char vector of a function. What is your end goal?
Also, you didn't @-mention Walter, so he may not notice this new question.
Hi Rik as well as Walter,
Actually Walter assist me alot. The code and the formulate the nonlinear analytical model (sometime has hundereds to thousands eqns). The model is OK, particularly for few datasets (<50); and initially I had used fprintf, but Walter recommened to use sprintf as to mitigate the challenges of fsolve and manipulation of FUN, @, etc;Walter, might aiming model simplification etc. Furthermore, we still have chance to use fprintf as to allow many rows than just one (which had trucanted (warned) by matlab, see the matlab output). Would you assist me, please
What are you trying to do?
Also, @Walter Roberson might have helped you before, but might not be aware of this thread.
Walter you have being assist me and our other collegues. Thank you for your tireless effort
Yes, my model stop to execute other assigned task; I think the space in window not enough as I got the following warn .. (could see above)
Output truncated. Text exceeds maximum line length
Yet, we still need your assistance

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Sparse Matrices에 대해 자세히 알아보기

태그

질문:

2024년 5월 4일

댓글:

2024년 5월 8일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by