matlabにおいて、さまざまなコイル位置での周波数に対するインピーダンスとインダクタンスの曲線を図に示したいのですが、グラフ表示がうまくできません。下の画像を見たら、値の入っていない変数があります。どういう風にしたら、値が入るのでしょうか、リンク内容と同じコードです。
Matlab
1addpath('c:\femm42\myFile') 2% Base problem name and configuration 3myFile='SSF-082.fem'; 4myCoilName='Icoil'; 5myCoilGroup=1; 6 7% Displacement range under consideration 8xmin=-15; 9xmax=15; 10dx=5; 11 12% Frequency range under consideration. 13wmin = 0; % 10^0 = 1 Hz 14wmax = 4; % 10^4 = 10000 Hz 15dw = 1/5; % 5 points per decade on a log scale 16% Open up base problem and save as the DC operating point with no coil current 17openfemm; 18opendocument(myFile); 19mi_setcurrent(myCoilName,0); 20mi_saveas('DCProblem.fem'); 21 22 23% Open up base problem and save as the incremental AC problem with a coil current of 1A 24% Incremental AC problem points back to the DC solution via the mi_setprevious('DCProblem.ans') call 25opendocument(myFile); 26mi_setcurrent(myCoilName,1); 27mi_setprevious('DCProblem.ans'); 28mi_saveas('ACProblem.fem'); 29 30% move the coil to the xmin position, assuming that the geometry is drawn so that the coil is nominally at x=0 31mi_setfocus('DCProblem.fem'); 32mi_selectgroup(myCoilGroup); 33mi_movetranslate(0,xmin); 34mi_setfocus('ACProblem.fem'); 35mi_selectgroup(myCoilGroup); 36mi_movetranslate(0,xmin); 37 38% Step through the full range of coil positions 39Lx=[]; 40Vx=[]; 41Bl=[]; 42Lo=[]; 43Xx=xmin:dx:xmax; 44Ww=10.^(wmin:dw:wmax); 45 46for x=xmin:dx:xmax 47 Lfd=[]; 48 Vfd=[]; 49 mi_setfocus('DCProblem.fem'); 50 mi_analyze(); 51 52 % Get inductance in the limiting case as frequency goes to zero 53 mi_setfocus('ACProblem.fem'); 54 mi_probdef(10^(-6)); 55 mi_analyze(); 56 mi_loadsolution(); 57 u=mo_getcircuitproperties(myCoilName); 58 Lo=[Lo, abs(u(3))]; 59 60 % At each coil position, evaluate Bl and coil inductance over a range of frequencies 61 for k=wmin:dw:wmax 62 mi_setfocus('ACProblem.fem'); 63 mi_probdef(10^k); 64 mi_analyze(); 65 mi_loadsolution(); 66 % Get Bl 67 if (k==0) 68 mo_groupselectblock(1); 69 f=abs(mo_blockintegral(29)); 70 Bl=[Bl, f]; 71 end 72 % Get Inductance and Voltage 73 u=mo_getcircuitproperties(myCoilName); 74 Lfd=[Lfd, u(3)]; 75 Vfd=[Vfd, u(2)]; 76 fprintf('%g %g %s\n',x,10^k,num2str(u(3))); 77 end 78 Lx=[Lx; Lfd]; 79 Vx=[Vx; Vfd]; 80 if (x<xmax) 81 mi_setfocus('DCProblem.fem'); 82 mi_selectgroup(myCoilGroup); 83 mi_movetranslate(0,dx); 84 mi_setfocus('ACProblem.fem'); 85 mi_selectgroup(myCoilGroup); 86 mi_movetranslate(0,dx); 87 end 88end 89closefemm; 90 91% Plot up some results 92figure(1); 93loglog(Ww,abs(Vx)); 94xlabel('Frequency, Hz'); 95ylabel('Impedance, Ohms'); 96title('Impedance vs. Frequency and Position'); 97 98figure(2); 99loglog(Ww,abs(1000*Lx)); 100xlabel('Frequency, Hz'); 101ylabel('Inductance, mH'); 102title('Inductance vs. Frequency and Position'); 103 104 105figure(3); 106plot(Xx,Bl); 107xlabel('Frequency, Hz') 108ylabel('B*l, N/A, Ohms') 109title('B*l vs. Frequency and Position')