私はy=exp[-x^2/2]のグラフを−3<x<3の範囲でグラフ化したいのですが以下のプログラムで実行するとxとyが変化しません。どこが間違っているのでしょうか?
#include <stdio.h>
#include <math.h>
#define num 100
int main(void) {
float x[num],y[num]; float step_size;
int step;
step_size=6/num; for(step=0;step<num;step++){
x[step]=(-3)+step_size*step;
y[step]=exp((-1)*x[step]*x[step]/2);
}
/* data output */
FILE *fp;
fp = fopen("exp.csv","w");
for (step=0;step<num;step++){ fprintf(fp,"%f,%f\n",x[step],y[step]); printf("%f,%f\n",x[step],y[step]);
} fclose(fp);
return 0; }
質問があります お願いします
Re: 質問があります お願いします
Advanced Supporting Developer
無理やりこじつけ(ぉ
無理やりこじつけ(ぉ