调用没有匹配函数 &没有命名的成员

No matching function for call to & No member named

本文关键字:成员 函数 调用      更新时间:2023-10-16

我遇到了两个错误。

关于" output.Add(r1.woltage((("的第一个错误;line.T给出"没有命名成员'add'in'std :: __ 1 ::数组"

关于调用函数的第二个错误。

这是我的标题;

static array<double,1> diodeClipper (array<double,1> 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
Resistor R1 (80.0);
Capacitor C1 (3.5e-5, Fs); // Capacitor & Inductor need sampling rate (Fs) in constructor
// create WDF circuit
Serie RC (&R1, &C1);
Serie root (&Vin, &RC);
// accurate simulation of GZ34 valve diode.
double Is = 125.56; // reverse saturation current
double Vt = 0.036;  // thermal voltage
// initial value for the voltage over the diode (n-1 memory)
double Vdiode = 0.0;
// for simulation
double b, r, Rdiode;
array<double,1> output;

// the simulation loop
int n=0; int max=input.size();
for (; n<max; ++n)
{
    Vin.Vs = input[n];                  // read the input signal for the voltage source
    b = root.reflected ();              // get the waves up to the root
    // ** VALVE RESISTOR **
    Rdiode = Is * exp(-Vt * Vdiode);    // the nonlinear resistance of the diode
    r = (Rdiode - root.R)               // update scattering coefficient (KCL)
    / (Rdiode + root.R);
    root.incident (r * b);              // evaluate the wave leaving the diode (root element)
    // ** UPDATE **
    Vdiode = root.voltage ();           // update the diode voltage for next time sample
    output.add (R1.voltage());          // the output is the voltage over the resistor R1
}
return output;}

和我的main.cpp

*out1 = diodeClipper(*in1, Fs); //Where i get "No matching..." error
*out2 = diodeClipper(*in2, Fs); //Where i get "No matching..." error

"没有成员名为'add'in'std :: __ 1 :: array':std::array不支持add函数。标准C 容器的正确推送功能是push_back,即使那样,std::array也不支持它,因为它的大小在编译时固定。

呼叫没有匹配函数:diodeClipperstd::array作为参数,但您将其传递给双重(删除C风格数组(。std::array是模板类,与C风格数组完全不同。