| 5 | 1/1 | 返回列表 |
| 查看: 2207 | 回復(fù): 6 | ||
| 【懸賞金幣】回答本帖問題,作者小蟲飛更高將贈(zèng)送您 5 個(gè)金幣 | ||
| 當(dāng)前只顯示滿足指定條件的回帖,點(diǎn)擊這里查看本話題的所有回帖 | ||
小蟲飛更高新蟲 (初入文壇)
|
[求助]
matlab光強(qiáng)編程,提示矩陣維度 必須一致,不知是哪里出現(xiàn)的問題,代碼在下面 已有1人參與
|
|
|
代碼如下: clear all; k=10; f=1004.8; x=-1.5:0.01:1.5; y=-1.5:0.01:1.5; [x1,y1]=meshgrid(x,y); r=sqrt(x1.^2+y1.^2); Phi=atan(y1./x1); I=(i*k*exp(i*(pi/2+k*f)).*sin(2.*Phi).*quadl(@(theta)(1+cos(theta))./(1-cos(theta)).*sin(theta).*Besselk(2,k.*r.*sin(theta)),2.23,pi)).^2; subplot(2,1,1); mesh(x1,y1,I); axis([-1.5 1.5 -1.5 1.5 0 1]); subplot(2,1,2); subimage(I*255); axis off; 出現(xiàn)錯(cuò)誤如下: 矩陣維度必須一致。 出錯(cuò) formula>@(theta)(1+cos(theta))./(1-cos(theta)).*sin(theta).*Besselk(2,k.*r.*sin(theta)) 出錯(cuò) quadl (line 62) y = feval(f,x,varargin{:}); y = y( .';出錯(cuò) formula (line 9) I=(i*k*exp(i*(pi/2+k*f)).*sin(2.*Phi).*quadl(@(theta)(1+cos(theta))./(1-cos(theta)).*sin(theta).*Besselk(2,k.*r.*sin(theta)),2.23,pi)).^2; |
新蟲 (初入文壇)
送紅花一朵 |
你好,我按照你的編程輸入了下,還是有提示錯(cuò)誤,請(qǐng)你在幫我解答下, clear all; k=10; f=1004.8; x=-0.5:0.01:0.5; y=-0.5:0.01;0.5 [x1,y1]=meshgrid(x,y); r=sqrt(x1.^2+y1.^2); [K,L]=size(r); for m=1:k for n=1:L Phi=atan(y1(n)./x1(m)); r0=r(m,n); eq=quadl(@(theta)(1+cos(theta))./(1-cos(theta)).*sin(theta).*Besselk(2,k.*r0.*sin(theta)),2.23,pi); I0=(i*k*exp(i*(pi/2+k*f))*sin(2*Phi)*eq).^2; I(m,n)=I0; end end Re=real(I);Im=imag(I); s.FaceColor='flat'; %subplot(2,1,1); C=rand(K,L); mesh(x1,y1,real(I).C);hold on 提示錯(cuò)誤如下: formula ans = 0.5000 未定義與 'double' 類型的輸入?yún)?shù)相對(duì)應(yīng)的函數(shù) 'Besselk'。 出錯(cuò) formula>@(theta)(1+cos(theta))./(1-cos(theta)).*sin(theta).*Besselk(2,k.*r0.*sin(theta)) 出錯(cuò) quadl (line 62) y = feval(f,x,varargin{:}); y = y( .';出錯(cuò) formula (line 13) eq=quadl(@(theta)(1+cos(theta))./(1-cos(theta)).*sin(theta).*Besselk(2,k.*r0.*sin(theta)),2.23,pi); >> |
至尊木蟲 (著名寫手)

新蟲 (初入文壇)
|
剛我又調(diào)試了下,出現(xiàn)如下錯(cuò)誤,您再幫我看下: k=10; f=1004.8; x=-0.5:0.01:0.5; y=-0.5:0.01:0.5; [x1,y1]=meshgrid(x,y); r=sqrt(x1.^2+y1.^2); [K,L]=size(r); for m=1:k for n=1:L Phi=atan(y1(n)./x1(m)); r0=r(m,n); eq=quadl(@(theta)(1+cos(theta))./(1-cos(theta)).*sin(theta).*besselk(2,k.*r0.*sin(theta)),2.23,pi); I0=(i*k*exp(i*(pi/2+k*f))*sin(2*Phi)*eq)^2; I(m,n)=I0; end end Re=real(I);Im=imag(I); s.FaceColor='flat'; %subplot(2,1,1); C=rand(K,L); mesh(x1,y1,real(I).C);hold on axis([-1.5 1.5 -1.5 1.5 0 1]); subplot(2,1,2); subimage(I*255); axis off 提示錯(cuò)誤: 定義變量 "real" 或類 "real"。 出錯(cuò) para (line 22) mesh(x1,y1,real(I).C);hold on |
至尊木蟲 (著名寫手)

| 不應(yīng)助 確定回帖應(yīng)助 (注意:應(yīng)助才可能被獎(jiǎng)勵(lì),但不允許灌水,必須填寫15個(gè)字符以上) |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|
百度網(wǎng)盤 |
360云盤 |
千易網(wǎng)盤 |
華為網(wǎng)盤
在新窗口頁(yè)面中打開自己喜歡的網(wǎng)盤網(wǎng)站,將文件上傳后,然后將下載鏈接復(fù)制到帖子內(nèi)容中就可以了。 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 0817一志愿蘇州大學(xué)280復(fù)試調(diào)劑 +7 | kk扛 2026-03-07 | 7/350 |
|
|---|---|---|---|---|
|
[考研] 315食品工程求調(diào)劑 +3 | Oreov0 2026-03-06 | 5/250 |
|
|
[考研]
|
簡(jiǎn)木ChuFront 2026-03-09 | 4/200 |
|
|
[考研] 348求調(diào)劑 +3 | wyx79618 2026-03-06 | 7/350 |
|
|
[考研] 【求調(diào)劑】293分環(huán)境工程求調(diào)劑材料/化工,服從調(diào)劑,抗壓能力強(qiáng)! +13 | xiiiia 2026-03-04 | 14/700 |
|
|
[考研] 材料調(diào)劑 +4 | xxxcm 2026-03-08 | 7/350 |
|
|
[考博] 26申博自薦 +9 | 烷基八氮- 2026-03-06 | 11/550 |
|
|
[考研] 2026考研求調(diào)劑-材料類-本科211一志愿985-初試301分 +7 | 蟲友233 2026-03-07 | 7/350 |
|
|
[考研] 290求調(diào)劑 +6 | Bananaiy 2026-03-04 | 6/300 |
|
|
[考研] 0701-322 求調(diào)劑 +3 | jiliuxian 2026-03-06 | 8/400 |
|
|
[教師之家] 交大前校長(zhǎng)王樹國(guó):現(xiàn)在最先進(jìn)的科技并不在大學(xué)實(shí)驗(yàn)室,而是在企業(yè)研究院 +4 | zju2000 2026-03-08 | 6/300 |
|
|
[考研] 288求調(diào)劑 +5 | 好好- 2026-03-07 | 5/250 |
|
|
[考研] 0817化學(xué)工程與技術(shù)312分求調(diào)劑 +7 | T123 tt 2026-03-04 | 7/350 |
|
|
[考研] 化學(xué)工程求調(diào)劑 +12 | 化工人999 2026-03-04 | 12/600 |
|
|
[考研] 301求調(diào)劑 +5 | 一二LV 2026-03-07 | 5/250 |
|
|
[考研] 08工科 +4 | li李樂成 2026-03-06 | 4/200 |
|
|
[考研] 276求調(diào)劑 本科天津工業(yè)大學(xué) 一志愿北京化工大學(xué)0855 +4 | 路lyh123 2026-03-06 | 6/300 |
|
|
[考研] 求調(diào)劑推薦 +4 | 微辣不吃 2026-03-06 | 4/200 |
|
|
[考研] 材料328求調(diào)劑 +10 | 一個(gè)蘿卜02 2026-03-03 | 10/500 |
|
|
[考研] 0856材料專碩274能調(diào)劑去哪里? +3 | 22735 2026-03-04 | 4/200 |
|