| 查看: 3502 | 回復(fù): 10 | |||
鐘聲入翠微銅蟲 (小有名氣)
|
[求助]
用matlab求解方程式 已有1人參與
|
||
|
假設(shè)a和b已知,a,b,x,y>0,求解x和y a=[1+(0.0172*x)^2]^(-y/2) b=y*arctan(0.0172*x) 希望可以提供程序代碼,或者解!非常感謝! |
版主 (知名作家)
|
這個需要嘗試,可以用 fsolve 函數(shù)隨機賦值求解。 結(jié)果不理想就要考慮方程是否正確,或者a,b取值是否合理。 function example_0708 clear; a=0.709133065; b=0.08555; x0 = [1,1]; x = fsolve(@root2d,x0); fprintf('\tx=%.8f\n',x(1)); fprintf('\ty=%.8f\n',x(2)); function F = root2d(x) F(1) = (1+(0.0172*x(1))^2)^(-x(2)/2)-a; F(2) = x(2)*atan(0.0172*x(1))-b; end end |

版主 (知名作家)
|
這個盡量不要做伸手黨,求解符號方程組,看看solve函數(shù)用法 發(fā)自小木蟲Android客戶端 |

銅蟲 (小有名氣)
送紅花一朵 |
我是去百度了solve用法,但是運行的時候一直顯示錯誤, 我最先給a,b賦值進行計算,但是一直顯示運算符錯誤 syms x y; >>[x ,y]=solve(' 0.709133=[1+(0.0172*x)^2]^(-y/2)','0.08555=y*arctan(0.0172*x)'); 然后使用了未賦值 clc,clear syms a b y x sola=solve(a==(1+(0.0172*x)^2)^(-y/2),x) %待求解的變量是x sol=solve(b==y*atan(0.0172*x),y) %待求解的變量是y 還是運算不出想要的東西 因為只會一點點matlab,就一直解決不了問題。 |
版主 (知名作家)

銅蟲 (小有名氣)
銅蟲 (小有名氣)
送紅花一朵 |
我自己又代入了一下,得到這樣的結(jié)果,是什么意思呢? Warning: The solutions are parameterized by the symbols: z, z1. To include parameters and conditions in the solution, specify the 'ReturnConditions' option. > In solve>warnIfParams (line 510) In solve (line 367) Warning: The solutions are valid under the following conditions: 1/((1849*z^2)/6250000 + 1)^(z1/2) - 6387302814580195/9007199254740992 == 0 & z1*atan((43*z)/2500) - 1711/20000 == 0 & 0 < z & 0 < z1. To include parameters and conditions in the solution, specify the 'ReturnConditions' option. > In solve>warnIfParams (line 517) In solve (line 367) X = z Y = z1 |
版主 (知名作家)

銅蟲 (小有名氣)
送紅花一朵 |
謝謝!(30000,0.05)這個初始值是自己根據(jù)實際情況設(shè)置,還是隨意設(shè)置的呢?這次我運行出來了,但是感覺結(jié)果不是我想象中的那樣。 發(fā)自小木蟲Android客戶端 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 293求調(diào)劑,一志愿陜師大生物學 +3 | ??????.?.??? 2026-03-09 | 3/150 |
|
|---|---|---|---|---|
|
[考研] 420求調(diào)劑 +3 | 莫向外求11 2026-03-10 | 3/150 |
|
|
[考研] 307求調(diào)劑 +6 | 超級伊昂大王 2026-03-10 | 6/300 |
|
|
[考研] 調(diào)劑 +5 | 調(diào)劑的考研學生 2026-03-09 | 5/250 |
|
|
[考研] 313分生物學求調(diào)劑 +5 | Yyt楊1 2026-03-09 | 7/350 |
|
|
[考研] 332材料求調(diào)劑 +6 | zjy101327 2026-03-05 | 8/400 |
|
|
[考研] 0703化學調(diào)劑 +3 | 三dd. 2026-03-10 | 3/150 |
|
|
[考研] 337一志愿華南理工材料求調(diào)劑 +5 | mysdl 2026-03-07 | 5/250 |
|
|
[考研] 0703化學求調(diào)劑 +4 | 很老實人 2026-03-09 | 4/200 |
|
|
[考研] 296求調(diào)劑 +4 | Xinyu Wu311 2026-03-09 | 4/200 |
|
|
[考研] 085701環(huán)境工程專碩求調(diào)劑 +5 | 幼稚園大班打手 2026-03-08 | 5/250 |
|
|
[考研] 0817找調(diào)劑 +6 | kk扛 2026-03-08 | 6/300 |
|
|
[考博] 26年博士申請 +4 | 科研狗111 2026-03-07 | 4/200 |
|
|
[考研] 346分材料求調(diào)劑 +5 | snow_反季節(jié)版 2026-03-07 | 5/250 |
|
|
[考研] 一志愿鄭大071000分數(shù)282求調(diào)劑 +3 | 研研顏 2026-03-05 | 7/350 |
|
|
[考研] 276求調(diào)劑 本科天津工業(yè)大學 一志愿北京化工大學0855 +4 | 路lyh123 2026-03-06 | 6/300 |
|
|
[考研] 材料277分求調(diào)劑 +13 | 飯飯星球 2026-03-04 | 14/700 |
|
|
[考研] 復(fù)試調(diào)劑 +7 | 呼呼?~+123456 2026-03-05 | 10/500 |
|
|
[考研] 316求調(diào)劑 +3 | 林小星發(fā)大財 2026-03-05 | 5/250 |
|
|
[考研] 286 +6 | ksncj 2026-03-04 | 6/300 |
|