Autor Beitrag
sekingofsering
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Di 01.02.05 00:17 
lese am anfang in ein feld x werte ein von -pi bis+ 2pi (150 teile geitilt)

bei der ersten test ausgabe passt noch alles da ist x[i] = - 3.14...
usw aber bei der 2. und 3. nicht mer das ist es 0.038 wieso verändere die werte doch nicht vom feld und greif nie darauf zu ??

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
 procedure TForm1.GradChange(Sender: TObject);
var g,i,j:integer ;
     a,y,z,z1:real;
x : array[1..151]of real;
//rechtai :array[1..12]of real;
saegeai:array[1..12]of real;
//rechtfkt:array[1..151,1..12]of real;
saegefkt:array[1..151,1..12]of real;

begin
a:=-Pi;
for i:=1 to 151   do
begin
x[i]:= a;
a:=a+0.062831853072;
end;
g:=StrToint(Grad.Text);

test.Text:= FloattoStr(x[1]);

 for i:=1 to 151 do
 begin
 saegeai[i]:=(Power(-1,i+1))/(2*i);
 end;

test2.Text:= FloattoStr(x[1]);

 for i:=1 to 12 do
 begin
  for j:=1 to 151 do        begin
       saegefkt[j,i]:=saegeai[i]*sin(i*x[i]);
       end;
       end;

test3.Text:= FloattoStr(x[1]);


Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt.
Moderiert von user profile iconChristian S.: Titel geändert
herzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 168

WINXP pro, SUSE Linux 9.0
D7 Pers.
BeitragVerfasst: Di 01.02.05 12:45 
Welche Funktion ist Power?
Rück mal deinen QC ein sonst kann das sowieso keiner lesen !
Benutzername
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 210

Win XP Pro
Delphi 7 PE, D2005 Prof. SSL
BeitragVerfasst: Di 01.02.05 13:42 
Power ist aus der Unit Math und ist für Basis^Exponent ;-)
st-matze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 138

Win 3.11, Win 95, Win 98, Win XP
D7 Ent, D6 Pers, (D5 Pers)
BeitragVerfasst: Di 01.02.05 14:16 
Achte auf deine Indizes

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
procedure TForm1.GradChange(Sender: TObject);
var
  i,j:integer ;
  a:real;
  x : array[1..151]of real;
  saegeai:array[1..12]of real;
  saegefkt:array[1..151,1..12]of real;
begin
  a:=-Pi;
  for i:=1 to 151   do
  begin
    x[i]:= a;
    a:=a+0.062831853072;
  end;
  test.Text:= FloattoStr(x[1]);
  for i:=1 to 151 do
    saegeai[i]:=(Power(-1,i+1))/(2*i);
  test2.Text:= FloattoStr(x[1]);
  for i:=1 to 12 do
    for j:=1 to 151 do
      saegefkt[j,i]:=saegeai[i]*sin(i*x[i]);
  test3.Text:= FloattoStr(x[1]);
end;
IngoD7
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 629


D7
BeitragVerfasst: Di 01.02.05 14:17 
sekingofsering hat folgendes geschrieben:
lese am anfang in ein feld x werte ein von -pi bis+ 2pi (150 teile geitilt)

bei der ersten test ausgabe passt noch alles da ist x[i] = - 3.14...
usw aber bei der 2. und 3. nicht mer das ist es 0.038 wieso verändere die werte doch nicht vom feld und greif nie darauf zu ??
Wie wäre es mal mit Punkt und Komma?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
 saegeai:array[1..12]of real;
...
 for i:=1 to 151 do
 begin
 saegeai[i]:=(Power(-1,i+1))/(2*i);
 end;


Dafür, dass saegeai nur 12 Elemente hat, ist die Schleife aber mächtig lang. :wink: