My code is used to produce a wave (y(:,1)) and I want to use that data into a formula Vout.
function [] = call_spring()
t = 0:0.001:5;
y0 = [0, 0];
x1 = 25*cos(4*pi*t);
[t, y] = ode45(@spring, t, y0);
plot(t, y(:,1), t, x1,'-r');
f=50;
Ip=12/10000;
Np=400;
Ns=200;
r=2;
x=y(:,1);
u0=4*pi*(10^-7);
b=320;
m=160;
Vout=f*Ip*((4*pi*Np*Ns*u0*b*x)/(3*m*log(r)))*(1-((x^2) / (2*b^2)))
end
function dzdt = spring(t, y)
k = 342;
m = 2.853;
x1 = 25*cos(4*pi*t);
y1 = y(1);
y2 = y(2);
dzdt = [y2;
(-k/m)*(y1-x1)];
end