Einzelnen Beitrag anzeigen

Andre_Schmidt

Registriert seit: 9. Aug 2006
9 Beiträge
 
#1

Problem bei Benutzung der TChart

  Alt 12. Dez 2006, 12:47
Hallo Leute....

ich steh vor folgendem Problem und zwar, wie bekomme ich mein p(x) nun in die TChart Komponente hinein,
ich hoffe es kann mir jemand behilflich sein

gruß Andre


Delphi-Quellcode:
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm5 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Button1: TButton;
    Button2: TButton;
    Edit7: TEdit;
    Edit8: TEdit;
    Edit9: TEdit;
    Edit10: TEdit;
    Edit11: TEdit;
    Edit12: TEdit;
    Edit13: TEdit;
    Edit14: TEdit;
    Edit15: TEdit;
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  procedure FormPAINT(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form5: TForm5;

implementation

{$R *.dfm}

procedure TForm5.Button1Click(Sender: TObject);
var
x0,x1,x2,x3,x4,y0,y1,y2,y3,y4,
x0x1,x1x2,x2x3,x3x4,
x0x1x2,x1x2x3,x2x3x4,
x0x1x2x3,x1x2x3x4,
x0x1x2x3x4:real;
c0,c1,c2,c3,c4,p,x:real;

begin
{Einlesen der Variablen}
x0:=StrToFloatDef(Edit1.Text,0);
x1:=StrToFloatDef(Edit2.Text,0);
x2:=StrToFloatDef(Edit3.Text,0);
x3:=StrToFloatDef(Edit4.Text,0);
x4:=StrToFloatDef(Edit5.Text,0);
y0:=StrToFloatDef(Edit6.Text,0);
y1:=StrToFloatDef(Edit7.Text,0);
y2:=StrToFloatDef(Edit8.Text,0);
y3:=StrToFloatDef(Edit9.Text,0);
y4:=StrToFloatDef(Edit10.Text,0);

{Berechnung 1.Spalte}
x0x1:=(y1-y0)/(x0-x1);
x1x2:=(y2-y1)/(x2-x1);
x2x3:=(y3-y2)/(x3-x2);
x3x4:=(y4-y3)/(x4-x3);

{Berechnung 2.Spalte}
x0x1x2:=(x1x2-x0x1)/(x2-x0);
x1x2x3:=(x2x3-x1x2)/(x3-x1);
x2x3x4:=(x3x4-x2x3)/(x4-x2);

{Berechnung 3.Spalte}
x0x1x2x3:=(x1x2x3-x0x1x2)/(x3-x0);
x1x2x3x4:=(x2x3x4-x1x2x3)/(x4-x1);

{Berechnung 4.Spalte}
x0x1x2x3x4:=(x1x2x3x4-x0x1x2x3)/(x4-x0);

c0:=y0;
c1:=x0x1;
c2:=x0x1x2;
c3:=x0x1x2x3;
c4:=x0x1x2x3x4;


{Ausgabe der Ergebnisse}
Edit11.Text := FloatToStr(c0);
Edit12.Text := FloatToStr(c1);
Edit13.Text := FloatToStr(c2);
Edit14.Text := FloatToStr(c3);
Edit15.Text := FloatToStr(c4);

{Zu Zeichnende Funktion}
p(x)=c0+c1*(x-x0)+c2*(x-x0)*(x-x1)+c3*(x-x0)*(x-x1)*(x-x2)+
        c4*(x-x0)*(x-x1)*(x-x2)*(x-x3);
  Mit Zitat antworten Zitat