none
C# komplexe Zahlen Berechnung RRS feed

  • Frage

  • Hi Leute,

    hab mal ne Frage. Ich muss in C# Form die Funktion H(jw) = 1/[1+(jw/w0)] in der Form plotten lassen.
    Hab bis jetz die komplexen Berechnungen weiss jetz aber nicht wie ich weiter vorgehe..
    Hier meine komplexe Klasse hoffe ihr könnt mir helfen:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace ComplexCalculation
    {
        public class Ccomplex
        {
            public double Real { get { return this._real; } set { this._real = value; } }
            public double Imag { get { return this._imag; } set { this._imag = value; } }
            public double Betrag { get { return Math.Sqrt(_real * _real + _imag * _imag); } }
            public double Phasenwinkel { get { return Math.Atan2(_imag, _real); } }
    
            private double _real = 0;
            private double _imag = 0;
    
    
            public Ccomplex(double Real)
            {
                this._real = Real;
            }
    
            public Ccomplex(double Real, double Imag)
            {
                this._real = Real;
                this._imag = Imag;
            }
    
            
            public static Ccomplex FromPolar(double Betrag, double Phasenwinkel)
            {
                double real = Betrag * Math.Cos(Phasenwinkel);
                double imag = Betrag * Math.Sin(Phasenwinkel);
                return new Ccomplex(real, imag);
            }
    
           
            public static Ccomplex operator *(Ccomplex number1, Ccomplex number2)
            {
                double betrag = number1.Betrag * number2.Betrag;
                double phasenwinkel = number1.Phasenwinkel + number2.Phasenwinkel;
    
                return Ccomplex.FromPolar(betrag, phasenwinkel);
            }
    
            public static Ccomplex operator /(Ccomplex number1, Ccomplex number2)
            {
                double betrag = number1.Betrag / number2.Betrag;
                double phasenwinkel = number1.Phasenwinkel - number2.Phasenwinkel;
                return Ccomplex.FromPolar(betrag, phasenwinkel);
            }
    
            //Kartesische Form
            public override string ToString()
            {
                return Real + "j" + Imag;
            }
    
            //Polarform
            public string ToPolarString()
            {
                return Betrag + "e^j" + (Phasenwinkel / (2 * Math.PI)) * 360;
            }
    
    
        }
    
    }

    Montag, 10. November 2014 08:26

Antworten