Harmoniques

Description

Electronique:
Etude de forme de signal en ajoutant des harmoniques sur une sinus de base.
N'ayant pas trouvé de prog sur le Net pour visualiser et étudier l'effet des harmoniques , j'en ai fait un;
l'affichage se fait sur 2 périodes .

Afin de faire ressortir les formes de signaux remarquables carré (paires), tiangle (impaires) , dent de scie (paires et impaires)

H0 = fondamentale
H2 à H10 harmoniques

Regler les "slider"
Check box , "efface", pour effacer à chaque changement, ou laisser pour voir les anciennes traces.

Source / Exemple :


Option Explicit
Dim cosx, siny As Single
Const PI = 3.14159

Private Sub Command1_Click()
    Dim i, positionX, positionY As Integer
    Dim H2, H3, h4, h5, h6, h7, h8, h9, h10, h11, h12 As Integer
    If Check1.Value = Checked Then Line (200, 2500)-(16000, 8000), , BF
    siny = 6.28 / 360
    cosx = cosx - 50
    For i = 1 To 720
        Me.DrawWidth = 1
        positionX = (i * 10) + 4000
        H2 = Sin(siny * (i * 2)) * 10 * (100 - Slider1.Value)
        H3 = Sin(siny * (i * 3)) * 10 * (100 - Slider2.Value)
        h4 = Sin(siny * (i * 4)) * 10 * (100 - Slider3.Value)
        h5 = Sin(siny * (i * 5)) * 10 * (100 - Slider4.Value)
        h6 = Sin(siny * (i * 6)) * 10 * (100 - Slider5.Value)
        h7 = Sin(siny * (i * 7)) * 10 * (100 - Slider6.Value)
        h8 = Sin(siny * (i * 8)) * 10 * (100 - Slider7.Value)
        h9 = Sin(siny * (i * 9)) * 10 * (100 - Slider8.Value)
        h10 = Sin(siny * (i * 10)) * 10 * (100 - Slider9.Value)
        
        positionY = Sin(siny * i) * (10 * (100 - Slider0.Value)) + H2 + H3 + h4 + h5 + h6 + h7 + h8 + h9 + h10 + 5000
        PSet (positionX, positionY), vbGreen
    Next i
    DoEvents

End Sub

Private Sub Command2_Click()
 Line (200, 200)-(16000, 10000), , BF

End Sub

Private Sub Command3_Click()
Slider0 = 0
Slider1 = 100
Slider2 = 100
Slider3 = 100
Slider4 = 100
Slider5 = 100
Slider6 = 100
Slider7 = 100
Slider8 = 100
Slider9 = 100
'Slider10 = 100

End Sub

Private Sub Command8_Click()
End
End Sub

Private Sub Slider0_Change()
Command1_Click
End Sub

Private Sub Slider1_Change()
Command1_Click

End Sub

Private Sub Slider2_Change()
Command1_Click
End Sub

Private Sub Slider3_Change()
Command1_Click
End Sub

Private Sub Slider4_Change()
Command1_Click
End Sub

Private Sub Slider5_Click()
Command1_Click
End Sub

Private Sub Slider6_Change()
Command1_Click
End Sub

Private Sub Slider7_Change()
Command1_Click
End Sub

Private Sub Slider8_Change()
Command1_Click
End Sub

Private Sub Slider9_Change()
Command1_Click
End Sub

Private Sub Timer1_Timer()
Timer1.Enabled = False
Command1_Click

End Sub

Conclusion :


c'est juste une ébauche , on pourrait ajouter d'autre chose,
L'effacement notament est un peu à améliorer...

Codes Sources

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.