I do not know if you are still interested in this question. Are you trying to solve a diffeqn or is it just a function from a set of ready made values of w? I got errors similar to what you get for my problem, till I resolved them as below for my example. Hope this helps you.
% Set time
tspan = [0 10];
% I give an example of same diff eqn but different values of parameters
% Since my example is a second order diff eqn, I have two values y(1) and y(2)
% Since there are three ckts there are three values for each ckt for y(1) and y(2)
y0 = [0 0 0 0.5 0.5 0.5]; % y(1) for each R,L,C combination followed by y(2)
R= [1 0.1 0.2]';
L =[0.5 0.1 0.2 ]';
C= [0.5 1 2]';
V= [1 1 1 ]';
%solve the ode
[t,y]=ode45(@fde, tspan,y0,[],V,R,L,C);
% Plot the results
plot(t,y(:,1),t,y(:,2),t,y(:,3))
title(' Solution of First Order DE in MATLAB');
xlabel('time t');
ylabel('Solution of i')
legend('y_1','y_2','y_3');
And the function is
function dydt = fde(t,y,V,R,L,C)
i=length(R);
dydt= [ y(1:i).* (-R./L) - (y(i+1:2*i).* (1./L)) + V./L;
y(1:i).* (1./C) ];
So the code works as desired. Maybe is this what you want?
