Thanks Tale!
Now i converted to WDL with no problem but i have problem with processing.
I'm trying to build simple LC circuit to understand processing output.
I can process with MATLAB but no luck with WDL.
MATLAB
Code:
Fs = 44100; % sample rate (Hz)
N = 20000; % number of samples to simulate
output = zeros(N,1);
CapVal1 = 3.6e-4; % the capacitance value in Farads
C1 = Capacitor(CapVal1, Fs);
Lval1 = 3.6e-4;
L1 = Inductor(Lval1, Fs);
L1.State = 10;
p1 = Parallel(C1,L1); % create WDF
CapVal2 = 4.6e-4; % the capacitance value in Farads
C2 = Capacitor(CapVal2, Fs);
Lval2 = 4.6e-4;
L2 = Inductor(Lval2, Fs);
L2.State = 10;
p2 = Parallel(C2,L2); % create WDF
s1 = Series(p1,p2);
for i=1:N
myB = WaveUp(s1);
WaveDown(s1,myB); % open circuit
output(i) = Voltage(p1) + Voltage(p2);
end
plot(output)
%soundsc(output, Fs)
WDL
Code:
double LC (double &input, double &Fs)
{
// 1 ohm is the Ri voltage source resistor
double Ri = 1.0;
// Internal circuit parameters
VoltageSource Vin (0.0, Ri); // initialize voltage at 0V
Capacitor C1 (3.6e-4, Fs);
Inductor L1 (3.6e-4, Fs);
// create WDF circuit
Parallel CL1 (&C1,&L1);
Capacitor C2 (4.6e-4, Fs);
Inductor L2 (4.6e-4, Fs);
Parallel CL2 (&C2,&L2);
Serie CL (&CL1, &CL2);
// for simulation
double output;
int n=0; int max=input.size();
for (; n<max; ++n)
{
//Can't write here//
}
return output;
}
Also i have issue with "int max=input.size();" it giving error.How to get size? And how to process according to MATLAB?
Thanks.