:
:
f(x) = 4/π(sin(x) + sin(3x)/3 + sin(5x)/5 + sin(7x)/7 + )
y=sin(x) f(x).
:
#include <stdio.h>
#include <math.h>
#include <conio.h>
void graphics(int n, int k, int amplituda, char path[], float out[][n+1]);
int main(int argc, char **argv)
{
int n; //
float h; //
float x0, x1; //
int k; //
float x; //
Float y, f;
int amplituda; //
char path[30]="E:/User/graphics.txt"; //
// , ,
// d:/user/out.txt
int i, j, j1; //
printf("\n Kol-vo grafikov. n=");
scanf("%d", &n);
printf("\n Nachalnoe znach. argumenta x0=");
scanf("%f", &x0);
printf("\n Konechnoe vremja integrir.: x1=");
scanf("%f", &x1);
printf("\n Shag vyvoda h=");
scanf("%f", &h);
printf("\n Max amplituda grafikov amplituda=");
scanf("%d", &lituda);
k=(int)((x1-x0)/h + 1);
float out[k][n+1]; // :
//
// : (x1-x0)/h +1
// - ,
// n - n
for (i=0; i<k; i++)
for (j=0; j<n+1; j++)
out[i][j]=0.0;
j1=-1;
for (x=x0; x<=x1; x+=h)
{
y=sin(x);
f=4.0/M_PI*(y + sin(3.0*x)/3.0 + sin(5.0*x)/5.0 + sin(7.0*x)/7.0 + sin(9.0*x)/9.0);
j1++;
out[j1][0]=x;
out[j1][1]=y;
out[j1][2]=f;
}
printf("\n-------------------------------");
printf("\n x sin(x) f(x)");
printf("\n-------------------------------\n");
for (i=0; i<j1; i++)
{
for (j=0; j<n+1; j++)
printf ("%10.5f", out[i][j]);
printf("\n");
}
printf("\n");
Graphics(n, k, amplituda, path, out);
Return 0;
}
:
, :
------------------------------------------------------------------------------------------
| x | g r a p h i c s
------------------------------------------------------------------------------------------
| 0.00000 | 21
| 0.10000 | 1 2
| 0.20000 | 1 2
| 0.30000 | 1 2
| 0.40000 | 1 2
| 0.50000 | 1 2
| 0.60000 | 1 2
| 0.70000 | 1 2
| 0.80000 | 1 2
| 0.90000 | 1 2
| 1.00000 | 1 2
| 1.10000 | 2 1
| 1.20000 | 2 1
| 1.30000 | 2 1
| 1.40000 | 2 1
| 1.50000 | 2 1
| 1.60000 | 2 1
| 1.70000 | 2 1
| 1.80000 | 2 1
| 1.90000 | 2 1
| 2.00000 | 2 1
| 2.10000 | 12
| 2.20000 | 1 2
| 2.30000 | 1 2
| 2.40000 | 1 2
| 2.50000 | 1 2
| 2.60000 | 1 2
| 2.70000 | 1 2
| 2.80000 | 1 2
|
|
| 2.90000 | 1 2
| 3.00000 | 1 2
| 3.10000 | 1 2
| 3.20000 | 2 1
| 3.30000 | 2 1
| 3.40000 |2 1
| 3.50000 |2 1
| 3.60000 | 2 1
| 3.70000 | 2 1
| 3.80000 | 2 1
| 3.90000 | 2 1
| 4.00000 | 2 1
| 4.10000 | 2 1
| 4.20000 | 21
| 4.30000 | 1 2
| 4.40000 |1 2
| 4.50000 |1 2
| 4.60000 |1 2
| 4.70000 |1 2
| 4.80000 |1 2
| 4.90000 |1 2
| 5.00000 |1 2
| 5.10000 | 1 2
| 5.20000 | 12
| 5.30000 | 2 1
| 5.40000 | 2 1
| 5.50000 | 2 1
| 5.60000 | 2 1
| 5.70000 | 2 1
| 5.80000 | 2 1
| 5.90000 |2 1
| 6.00000 |2 1
| 6.10000 | 2 1
| 6.20000 | 2 1
| 6.30000 | 1 2
, :
1 y = sin(x),
2 .
:
1. :
void matr_peredat_funkc(int n, int m, int k, int phase_koord, int control, int vyhod, float a[n][n], float b[n][m], float c[k][n], float q[3][n+1]);
2. n ( ),
3. m ,
4. k
(); , k=0,
5. :
a[n][n] ,
b[n][m] ,
[k][n] ( ),
q[3][n+1]-
:
- ,
- " /",
- " /",
6. a[n][n], b[n][m] [k][n] ( ),
7. :
phase_koord - ,
control - ,
vyhod - () ,
8. :