Error in my code : Array dimensions must match for binary array op. Error in newhet (line 139) lamd4=20*D3-30*D2+12*D1-D0;
조회 수: 1 (최근 30일)
이전 댓글 표시
This is the code
C0=nansum(c0,2);
lamc1=C0;
C1=nansum(c1,2);
lamc2=2*C1-C0;
C2=nansum(c2,2);
lamc3=6*C2-6*C1+C0;
C3=nansum(c3,2);
lamc4=20*C3-30*C2+12*C1-C0;
The above same code is running but the error is coming in higlighted portion.
D0=nansum(d0,2);
lamd1=D0;
D1=nansum(d1,2);
lamd2=2*D1-D0;
D2=nansum(d2,2);
lamd3=6*D2-6*D1+D0;
D3=nansum(c3,2);
lamd4=20*D3-30*D2+12*D1-D0;
댓글 수: 0
답변 (1개)
Ishaan Mehta
2022년 6월 25일
Hi Namrata
In the second last line, it says:
D3=nansum(c3,2);
Judging by the code above the given line, it seems to be a typo, and the correct code should use d3 instead of c3:
D3=nansum(d3,2);
Using c3 instead of d3 should be the reason for mismatch in array dimensions, assuming C0 and D0 have different dimensions to begin with.
Hope this helps
Ishaan
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!