Solenoid - Integration of inductance L as a function of plunger position x

9 Ansichten (letzte 30 Tage)
Hello All,
I am in the process of evaluating the value of inductance L at each step of the plunger position in a solenoid according to the differential equation:
Force = 0.5*i^2*dL/dx
The value of current is a constant at 8.75 A. The value of force F varies at each step of the plunger position. dL/dx data for each step of the plunger position is available from the manufacturer force-stroke data. I need to integrate dL/dx to get L as a function of x. I tried using the ode45 function.
Lo = 3.8184e-3; % initial value of inductance
i = 8.74; % current in ampere
x = plungerPosition; % plungerPosition (984x1 double) data imported from excel
[x,L] = ode45(@(x,L) F/0.5*i^2, x, L0); % F (984x1 double) data also imported from excel, force in newton
But I get the following error:
Error using odearguments (line 95)
@(X,L)F/0.5*I^2 returns a vector of length 984, but the length of initial conditions vector is 1. The vector returned by
@(X,L)F/0.5*I^2 and the initial conditions vector must have the same number of elements.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in IntegrationofdL (line 4)
[x,L] = ode45(@(x,L) F/0.5*i^2, x, L0);
Can you please help me how I can solve this problem?
Thanks and Regards,
Goutham Sajja
  1 Kommentar
Goutham Sajja
Goutham Sajja am 16 Mai 2021
Dear All,
A little update to the previous query. I modified the ode45 code to obtain the value of inductance for each changing of the plunger position x.
L0 = 3.8184e-3; % initial value of inductance
i = 8.75; % current in ampere
x = plungerPosition;
for j = 1:numel(F)
[x,L] = ode45(@eval, x, L0,[],F(j)); % F is the force at each plunger position
end
function dLdx = eval(x,F,i)
dLdx = (F/0.5*i^2); % equation is dL/dx = F/0.5*i^2
end
With this code, I get the value of inductance L for each plunger position x.
Could you please tell me if the code that I have written is correct?
Thanks and Regards,
Goutham Sajja

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Vimal Rathod
Vimal Rathod am 22 Jun. 2021
Hi Goutham,
Few things I would like to point out are, you seem to be passing a lot of arguments to the ode45 function call which might not work. Also, "eval" is matlab defined function which already exists, so I would suggest you to use some other name say "eval1". Make sure to define function in a different .m file. I have added a way to store the L values when returned from ode45 in a cell array.
Have a look at the following snippet, hopefully it helps.
L0 = 3.8184e-3; % initial value of inductance
i = 8.75; % current in ampere
x = plungerPosition;
Lval = {};
for j = 1:numel(F)
[x,L] = ode45(@(x,L)eval1(x, F(j), i), x, L0); % F is the force at each plunger position
Lval{end+1} = L;
end
% Below lines should be in a different file named "eval1.m"
function dLdx = eval1(x,F,i)
dLdx = (F/0.5*i^2); % equation is dL/dx = F/0.5*i^2
end
Refer to the following document for more examples on ode45

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by