« Return to Thread: Same plot for two functions

Re: Same plot for two functions

by Thomas G.-2 :: Rate this Message:

Reply to Author | View in Thread

Hello George,
another option is the command
 hold on/off

A little example using some more options:
% Create "time"-vector
t = [1:1/10:2*pi];
% Open figure number 1
figure(1)
% Clear the figure
clf
% Plot a sine-wave
% -  --> full line
% r --> color is red
% d --> marker diamond
plot(t,sin(t),'-rd')

% Tell octave to hold the plot
hold on

% Plot cosine with double frequency
% . --> print only points
%o --> marker circle
% b --> line is blue
plot(t,cos(2*t),'.ob')

% Switch on the grid
grid on

% Give some description
xlabel('Time / s')
ylabel(' \phi / -')
title('This is an example')

Regard
Thomas


george brida schrieb:
Dear friends,
if I have two functions of variable t, how to represent them in the same plot?
Say, f(t)=2*t and g(t)=t*t
Thank you very much

_______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave


_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

 « Return to Thread: Same plot for two functions