Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tp_convolution
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
denis.gremaud
tp_convolution
Commits
4f26fdcc
Commit
4f26fdcc
authored
4 years ago
by
aya.mouzahim
Browse files
Options
Downloads
Plain Diff
23.06.21
parents
d2fba2c5
97875d40
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
main.c
+6
-0
6 additions, 0 deletions
main.c
src/conv_1d.c
+7
-0
7 additions, 0 deletions
src/conv_1d.c
src/int_num.c
+6
-0
6 additions, 0 deletions
src/int_num.c
with
19 additions
and
0 deletions
main.c
+
6
−
0
View file @
4f26fdcc
/**************************************************
TP intégrales maths
Auteurs: Denis Gremaud, Aya Mouzahim
Date 06.06.2021
Version 1.0
**************************************************/
#include
"src/int_num.h"
#include
"src/conv_1d.h"
#include
"pgm/pgm.h"
...
...
This diff is collapsed.
Click to expand it.
src/conv_1d.c
+
7
−
0
View file @
4f26fdcc
#include
"conv_1d.h"
// filtrage par oméga 1
double
filtrage_par_s_w1
(
double
x
,
double
w1
,
double
w2
){
double
alpha
=
w1
/
w2
;
return
-
(
sin
(
2
*
pi
*
w1
*
x
)
*
sin
(
pi
*
alpha
))
/
(
pi
*
alpha
);
}
// filtrage par oméga 2
double
filtrage_par_s_w2
(
double
x
,
double
w1
,
double
w2
){
double
alpha
=
w1
/
w2
;
return
-
alpha
*
(
sin
(
2
*
pi
*
w2
*
x
)
*
sin
(
pi
*
alpha
))
/
(
pi
);
}
// fonction du calcul du signal S
double
s
(
double
x
,
double
w1
,
double
w2
){
return
sin
(
2
*
pi
*
w1
*
x
)
+
sin
(
2
*
pi
*
w2
*
x
);
}
// fonction de filtrage pour la convolution
double
f_conv
(
double
x
,
double
psi
){
if
(
x
>
-
psi
/
2
&&
x
<
psi
/
2
)
{
...
...
@@ -24,6 +28,7 @@ double f_conv(double x, double psi){
}
}
// fonction de convolution f_conv par s
double
I_conv_f
(
double
a
,
double
b
,
double
n
,
double
psi
,
double
w1
,
double
w2
){
double
res
=
0
;
double
d_x
=
(
b
-
a
)
/
n
;
...
...
@@ -35,6 +40,7 @@ double I_conv_f(double a, double b, double n, double psi, double w1, double w2){
return
res
;
}
// fonction de convolution h par s
double
I_conv_h
(
double
a
,
double
b
,
double
n
,
double
psi
,
double
w1
,
double
w2
){
double
res
=
0
;
double
d_x
=
(
b
-
a
)
/
n
;
...
...
@@ -46,6 +52,7 @@ double I_conv_h(double a, double b, double n, double psi, double w1, double w2){
return
res
;
}
// fonction h autre fonction de filtrage pour la convolutuion
double
h
(
double
x
,
double
psi
){
return
(
1
/
sqrt
(
2
*
pi
*
psi
))
*
exp
(
-
pow
(
x
,
2
.
0
)
/
(
2
*
psi
));
}
This diff is collapsed.
Click to expand it.
src/int_num.c
+
6
−
0
View file @
4f26fdcc
#include
"int_num.h"
// fonction de départ
double
f
(
double
x
){
return
-
((
2
*
x
-
1
)
/
exp
(
pow
(
x
,
2
)
-
x
+
2
));
}
// intégrale de la fonction de départ
double
f_intergrale
(
double
a
,
double
b
){
double
integrale_a
=
exp
(
-
(
pow
(
a
,
2
)
-
a
+
2
));
double
integrale_b
=
exp
(
-
(
pow
(
b
,
2
)
-
b
+
2
));
return
integrale_b
-
integrale_a
;
}
// calcul de l'intégrale grâce a la methode du rectangle à gauche
double
I_rect
(
double
a
,
double
b
,
double
n
){
double
res
=
0
;
double
d_x
=
(
b
-
a
)
/
n
;
...
...
@@ -19,14 +22,17 @@ double I_rect(double a, double b, double n){
return
res
;
}
// calcul erreur avec fonction du rectangle à gauche
double
E_rect
(
double
a
,
double
b
,
double
n
){
return
fabs
((
f_intergrale
(
a
,
b
)
-
I_rect
(
a
,
b
,
n
))
/
f_intergrale
(
a
,
b
));
}
// calcul erreur avec fonction du trapèze
double
E_trapeze
(
double
a
,
double
b
,
double
n
){
return
fabs
((
f_intergrale
(
a
,
b
)
-
I_trapeze
(
a
,
b
,
n
))
/
f_intergrale
(
a
,
b
));
}
// calcul de l'intégrale grâce a la methode du trapèze
double
I_trapeze
(
double
a
,
double
b
,
double
n
){
double
res
=
0
;
double
d_x
=
(
b
-
a
)
/
n
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment