mirror of https://github.com/Askill/AP-SCE.git
- fixed a6.2.2 (quad)
This commit is contained in:
parent
020311b429
commit
c545f1b09d
|
|
@ -20,11 +20,11 @@ void mexFunction(int nlhs, mxArray *plhs[], // Output
|
||||||
double ya = 0;
|
double ya = 0;
|
||||||
|
|
||||||
|
|
||||||
//trapz
|
//quad
|
||||||
mxArray *func_Input[1];
|
mxArray *func_Input[1];
|
||||||
mxArray *func_Outputs[1];
|
mxArray *func_Outputs[1];
|
||||||
|
|
||||||
for(int i = 0; a < x1; a += precision)
|
for(int i = 0; a < x1; a += precision,i++)
|
||||||
{
|
{
|
||||||
func_Input[0] = mxCreateDoubleScalar(a);
|
func_Input[0] = mxCreateDoubleScalar(a);
|
||||||
mexCallMATLAB(1, func_Outputs , 1 , func_Input , func_Name);
|
mexCallMATLAB(1, func_Outputs , 1 , func_Input , func_Name);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
% function accepts 1 string and 3 doubles
|
% function accepts 1 string and 3 doubles
|
||||||
% a622("function", interval_start, interval_end, precision)
|
% a622("function", interval_start, interval_end, precision)
|
||||||
%
|
%
|
||||||
% a622 implements trapz (integral)
|
% a622 implements simpson quad (integral)
|
||||||
%
|
%
|
||||||
%exp.: a622("sin",0,pi/2,0.000001)
|
%exp.: a622("sin",0,pi/2,0.000001)
|
||||||
% ans = 1.0000
|
% ans = 1.0000
|
||||||
|
|
@ -16,6 +16,7 @@ void nlgs();
|
||||||
void optimization();
|
void optimization();
|
||||||
void diff();
|
void diff();
|
||||||
void integ();
|
void integ();
|
||||||
|
void anfangswert();
|
||||||
|
|
||||||
void print_array(long double* a, int size)
|
void print_array(long double* a, int size)
|
||||||
{
|
{
|
||||||
|
|
@ -48,7 +49,7 @@ int main()
|
||||||
cout << "4 optimization" << endl;
|
cout << "4 optimization" << endl;
|
||||||
cout << "5 numerische differentation" << endl;
|
cout << "5 numerische differentation" << endl;
|
||||||
cout << "6 numerische Integration" << endl;
|
cout << "6 numerische Integration" << endl;
|
||||||
|
cout << "7 Anfangswertproblem" << endl;
|
||||||
cout << "e Beenden" << endl;
|
cout << "e Beenden" << endl;
|
||||||
|
|
||||||
cin >> auswahl;
|
cin >> auswahl;
|
||||||
|
|
@ -61,6 +62,7 @@ int main()
|
||||||
case '4': optimization(); break;
|
case '4': optimization(); break;
|
||||||
case '5': diff(); break;
|
case '5': diff(); break;
|
||||||
case '6': integ(); break;
|
case '6': integ(); break;
|
||||||
|
case '7': anfangswert(); break;
|
||||||
|
|
||||||
default: cout << "Okay, bye" << endl; break;
|
default: cout << "Okay, bye" << endl; break;
|
||||||
}
|
}
|
||||||
|
|
@ -174,3 +176,8 @@ void integ()
|
||||||
cout << integ.trapz(0, (PI / 2), 0.001) << endl << endl;
|
cout << integ.trapz(0, (PI / 2), 0.001) << endl << endl;
|
||||||
cout << integ.quad(0, (PI / 2), 0.001) << endl << endl;
|
cout << integ.quad(0, (PI / 2), 0.001) << endl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void anfangswert()
|
||||||
|
{
|
||||||
|
cout << "nope";
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue