0
我一直在玩這一段時間,任何人都可以解釋爲什麼我從Code1和Code2得到不同的答案?關於'dsolve()'的實際腳本是什麼使得2個代碼的輸出不同?可以輸出,如果我只是用不同的語法相同(即」;」。「)dsolve生成不一致的輸出
%Code1:
syms Qua t Area height
rate_in = 3*Qua*(sin(t))^2;
delta_Vol = dsolve('DAreaY = rate_in - Qua');
delta_Height= dsolve('Dheight = ((rate_in - Qua)/Area)', 'height(0) = 0');
subfnc1 = subs(rate_in, {Qua}, {450});
fnc1 = subs(delta_Height, {'rate_in'}, {subfnc1});
fnc1 = subs(fnc1, {Area, Qua}, {1250,450});
fnc_main = matlabFunction(fnc1);
fnc_main(0:10)';
%Code2:
syms Qua t Area height
rate_in = 3*Qua*(sin(t))^2;
delta_Vol = dsolve('DAreaY = 3*Qua*(sin(t))^2 - Qua');
delta_Height= dsolve('Dheight = ((3*Qua*(sin(t))^2 - Qua)/Area)', 'height(0) = 0');
fnc1 = subs(delta_Height, {Area, Qua}, {1250,450});
fnc_main = matlabFunction(fnc1);
fnc_main(0:10)';
是什麼樣的dsolved功能我不明白
謝謝,這是另一種我可以選擇編碼的視角/路線,書籍/教師沒有提供。謝謝你,因爲我認爲dsolve()只接受字符串,但現在我看到我如何插入符號參數。我也從來不知道我可以有一個變量聲明,就像用另一個變量明確定義的高度一樣,如(t)。 – ReadyF4i