"Data dimensions must agree" Error
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm trying to create a surface plot for the maximum inductance achievable with a solenoid of a certain length of wire with a certain wire diameter. I've created a surface plot for the diameter required to achieve maximum inductance with the previous variables, but once I insert that diameter variable into the equation for inductance, I get an error. This is what I have for graphing the diameter:
l = 12:24:24012;
w = [.008 .0089 .01 .0113 .0126 .0142 .0159 .0179 .0201 .0226 .0254 .0285 .032 .0359 .0403 .0453 .0508 .0571 .0641 .072 .0808 .0907 .1019 .1144 .1285];
awg = (-39 * (log(w/.005))/log(92)) + 36;
[l,w] = meshgrid(l,w);
d = abs(sqrt(20*l.*w./(9*pi)));
surf(l,awg,d,'edgecolor','none')
That one works perfectly. This is what I have for graphing the inductance:
l = 12:24:24012;
w = [.008 .0089 .01 .0113 .0126 .0142 .0159 .0179 .0201 .0226 .0254 .0285 .032 .0359 .0403 .0453 .0508 .0571 .0641 .072 .0808 .0907 .1019 .1144 .1285];
awg = (-39 * (log(w/.005))/log(92)) + 36;
[l,w] = meshgrid(l,w);
d = abs(sqrt(20*l.*w./(9*pi)));
L = ((l.^2)/(18*pi*pi*d) + (l.*d)/(w.*40*pi))/1000000;
surf(l,awg,L,'edgecolor','none')
As you can see, they're almost identical. All I did was add the equation for inductance and change the surf variable d to L. I've tried making up values for l and awg, and I'm able to plot it by hand if I wanted to waste my life doing that, so the equations work and shouldn't be the problem. How can I fix this error?
The exact wording of the error is as follows:
Error using surf (line 75)
Data dimensions must agree.
Error in MaxInductance (line 7)
surf(l,awg,L,'edgecolor','none')
댓글 수: 0
채택된 답변
Walter Roberson
2014년 2월 8일
L = ((l.^2)./(18*pi*pi*d) + (l.*d)./(w.*40*pi))./1000000;
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!