« Mathc gnuplot/Application : Fonction Heaviside » : différence entre les versions
Contenu supprimé Contenu ajouté
Aucun résumé des modifications |
Aucun résumé des modifications |
||
Ligne 44 :
/* ------------------------------------ */
#include "x_ahfile.h"
/* ------------------------------------ */
int main(void)
{
printf(" H : if(x>0) 1 else 0 \n");
G_plot(i_WGnuplot(-2.,20.,-1.,2.),
i_time(-2.,20.,0.001),
H);
printf("\n load \"a_main.plt\" with gnuplot."
"\n Press return to continue ");
getchar();
Ligne 92 ⟶ 74 :
/* ------------------------------------ */
#include "x_ahfile.h"
/* ------------------------------------ */
double v(
Ligne 100 ⟶ 80 :
double n=0, r=0;
return(r);
Ligne 109 ⟶ 88 :
int main(void)
{
printf(" H : if(x>0) 1 else 0 \n\n"
" v : x-> %s \n\n",veq);
G_plot(i_WGnuplot(-2.,20.,-1.,2.),
printf("\n\n load \"a_main.plt\" with gnuplot."
Ligne 152 ⟶ 121 :
<source lang="c">
/* ------------------------------------ */
/* Save as : x_ahfile.h
/* ------------------------------------ */
#include <stdio.h>
Ligne 161 ⟶ 130 :
#include <string.h>
/* ------------------------------------ */
#include "xa_strct.h"
#include "fh.h"
#include "g_f.h"
</source>
=== Les structures ===
<source lang="c">
/* ------------------------------------ */
/* Save as : xa_strct.h */
/* ------------------------------------ */
typedef struct
{
double xmini;
double xmaxi;
double ymini;
double ymaxi;
}W_Ctrl, *PW_Ctrl;
/* ------------------------------------ */
W_Ctrl i_WGnuplot(
double xmini,
double xmaxi,
double ymini,
double ymaxi
)
{
W_Ctrl w = {xmini,xmaxi,ymini,ymaxi};
return (w);
}
/* ------------------------------------ */
typedef struct
{
double mini;
double maxi;
double step;
}t_Ctrl, *Pt_Ctrl;
/* ------------------------------------ */
t_Ctrl i_time(
double mini,
double maxi,
double step
)
{
t_Ctrl t = {mini,maxi,step};
return (t);
}
</source>
Ligne 186 ⟶ 208 :
<source lang="c">
/* ------------------------------------ */
/* Save as : g_f.h */
/* ------------------------------------ */
/* ------------------------------------ */
/* Save as : g_f.h */
/* ------------------------------------ */
void G_plot(
W_Ctrl W,
t_Ctrl T,
double
)
{
FILE *fp;
fp = fopen("a_main.plt","w");
fprintf(fp," set zeroaxis lt 8\n"
" set grid
" plot [%0.3f:%0.3f] [%0.3f:%0.3f] \\\n"
" \"
" reset",
fclose(fp);
fp = fopen("data","w");
for(
fprintf(fp," %6.3f %6.3f\n",t,(*P_f1)(t));
fclose(fp);
}
Ligne 228 ⟶ 244 :
set zeroaxis lt 8
set grid
plot [-2.000:20.000] [-1.000:6.000] \
"data" with line lt 3
reset
|