does anybody know how to plot the Dirac function in top left corner and the sinus function given in the picture. I managed to plot the second and third easily. Would you do this with a piecewise function or is there an easy way for Plot #1 and #4 ? Thank you very much!
If this is homework then I suppose that for the sinus example you are being asked to investigate the effects of scale and shift.
Consider these plots, one after another. Observe how they differ. First I scale the magnitude (y-direction) by 10. Then I scale in the x-direction. And finally I shift in the x-direction.
plots:-setoptions(size=[300,0.6],tickmarks=[decimalticks,default]):
plot( 10*sin( x ), x=0 .. Pi, view=[0..Pi, 0..18] );
plot( 10*sin( x*Pi ), x=0 .. 1, view=[0..1, 0..18] );
plot( 10*sin( x*Pi/0.3 ), x=0 .. 0.3, view=[0..1, 0..18] );
plot( 10*sin( (x-0.1)*Pi/0.3 ), x=0.1 .. 0.4, view=[0..1, 0..18] );
plots:-setoptions();
It can be made to look similar to the 4th plot in the image to which you linked quite easily. You can try it with and without the various options.
P:= plot( 10*sin( (x-0.1)*Pi/0.3 ), x=0.1 .. 0.4
, axes=none
, color=black
, size=[300,0.7]
, thickness=2
):
plots:-display( P
, view=[0.0 .. 0.6, 0..18]
, tickmarks=[[0.1,0.4],[10=10*N]]
, axes=normal, labels=[`t[s]`,`F(t)`]
, size=[300,0.6]
);
And with more effort it can be made a closer match, visually.
plots:-display( P
, plottools:-arrow([0,0],[0.6,0], 0.05, 0.9, 0.05)
, plottools:-arrow([0,0],[0,16], 0.001, 0.02, 0.08)
, plots:-textplot([0.6, -3.5, `t[s]`, font=["courier",16]])
, plots:-textplot([0.0, 18, `F(t)`, font=["courier",16]])
, seq(plots:-textplot([X, -1.5, X]), X=[0,0.1,0.4])
, plots:-textplot([-0.05, 10, "10 N"])
);
For your other plot you could simply plot a sequence of lines.
T:=table([1=60,2=100,3=0,4=20]):
P2:=seq(plottools:-line([i,0],[i,T[i]],thickness=2,color=black),
i=1..4):
And you could adjust the look and feel of the final plot as above. I'll leave that to you.
plots:-display(P2
, size=[300,0.7]
, view=[0..6, 0..120]
, labels=["",""]
);