/* Moving plot of Function is basically a 3 dimensional plot
in which a 2D plot is move with third independent variable.
so the function is y=f(x,t)
here the x is horizontal independent variable and t is time.
The 3-D curve is display in this program as 2D cross section of
original curve.
/*
Function Plotting
Function is a relation in which every element in Range is essentially related to Domain.
*/
// Drawing Code Goes from here
#include<iostream.h>
#include<math.h>
#include<conio.h>
#include<graphics.h>
#define pi 3.141592
void clear(); //Prototype of clear screen function
void main()
{
int driver=DETECT, mode;
double x=0,y=0;
double scl=10,acc=.01,tacc=.1;
int ox=320,oy=240;
int posx=0,posy=0;
initgraph(&driver,&mode,"Panakj");
double dposx,dposy;
dposx=0;
dposy=0;
tacc=.1; //time sampling rate
acc=.1; //Horizontal sampling rate
scl=10; //Zoom of curve
y=acc; for(double t=-2*pi;t<=2*pi;t+=tacc)
{
clear();
dposx=0;
dposy=oy;
for (x=-32;x<=32;x+=acc)
{
y=10*sin(x*t*t); //Our Function Goes here
//Change the function for plotting
posx=ox+scl*x;
posy=oy-scl*y;
// putpixel(posx,posy,WHITE);
setcolor(WHITE);line(dposx,dposy,posx,posy);
dposx=posx;
dposy=posy;
}
}
cout<<"Pushpkant";
getch();
closegraph();
}
void clear()
{
setfillstyle(0,2);
bar(0,0,640,480);
}
in which a 2D plot is move with third independent variable.
so the function is y=f(x,t)
here the x is horizontal independent variable and t is time.
The 3-D curve is display in this program as 2D cross section of
original curve.
/*
Function Plotting
Function is a relation in which every element in Range is essentially related to Domain.
*/
// Drawing Code Goes from here
#include<iostream.h>
#include<math.h>
#include<conio.h>
#include<graphics.h>
#define pi 3.141592
void clear(); //Prototype of clear screen function
void main()
{
int driver=DETECT, mode;
double x=0,y=0;
double scl=10,acc=.01,tacc=.1;
int ox=320,oy=240;
int posx=0,posy=0;
initgraph(&driver,&mode,"Panakj");
double dposx,dposy;
dposx=0;
dposy=0;
tacc=.1; //time sampling rate
acc=.1; //Horizontal sampling rate
scl=10; //Zoom of curve
y=acc; for(double t=-2*pi;t<=2*pi;t+=tacc)
{
clear();
dposx=0;
dposy=oy;
for (x=-32;x<=32;x+=acc)
{
y=10*sin(x*t*t); //Our Function Goes here
//Change the function for plotting
posx=ox+scl*x;
posy=oy-scl*y;
// putpixel(posx,posy,WHITE);
setcolor(WHITE);line(dposx,dposy,posx,posy);
dposx=posx;
dposy=posy;
}
}
cout<<"Pushpkant";
getch();
closegraph();
}
void clear()
{
setfillstyle(0,2);
bar(0,0,640,480);
}
No comments:
Post a Comment
If the contents is insufficient or if there any error, please write here....
Suggestion are welcome: