help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

searching for octave plotting templates/examples


From: tomdylan
Subject: searching for octave plotting templates/examples
Date: Wed, 16 Apr 2014 04:39:50 -0700 (PDT)

After having gained some experience with OCTAVE 3.8.1 I am looking forward to
create more sophisticated plots that can be copied in reports. As a beginner
I got kind of shocked by the variety of commands and "tricks" that permit
the implementation of very specific plots. Therefore I tried to find some
simple

plotting templates like  here
<http://engineeringliberty.wordpress.com/2011/10/07/making-great-plots-in-octave-and-matlab-too/>
  


that would allow me to enter "octave´s wonder world of magic plotting".

Basically the above link gives a detailed description of a lot of features
to adapt:

plot size
font
font size
title
legend 
etc.

However there still are some things I do not understand, e.g. how to link
tff-fonts in a windows environment (instead of linux) or the
findall-command. How to print on A4-paper, how to control the size of the
legend window etc.

Probably I could better understand the concepts if I had some more plotting
templates.

I would appreciate if somebody could give hints on such templates consisting
of a simple algorithm providing some kind of graph and the commands to
control of single or multiple plots on one page ready for inclusion in 
reports (see example below).

________________
clear;clc;close all;

x0= 0.025; %m
v0= 0.000; %m/s
t = linspace(0,60,1000);
m = 1;     % kg
c = 0.1;   % N*sec/meter
k = 2.5;   % N/m

omega_n = sqrt(k/m)
zeta    = 0.5*c/m/omega_n

x = exp(-zeta*omega_n*t).*(x0*cos(sqrt(1-zeta^2)*omega_n*t) +...
   (v0+zeta*omega_n*x0)/sqrt(1-zeta^2)/omega_n*...
   (sin(sqrt(1-zeta^2)*omega_n*t)));

h=figure(1);
plot(t,x.*1000,'r-','LineWidth',4);
grid on;
FN = findall(h,'-property','FontName');
set(FN,'FontName','/usr/share/fonts/dejavu/DejaVuSerifCondensed.ttf');
FS = findall(h,'-property','FontSize');
set(FS,'FontSize',6);
title("Response of an Underdamped Single Degree of\n"...
      "Freedom System Subjected to an Initial Excitation",...
      'FontName','/usr/share/fonts/dejavu/DejaVuSerif-Italic.ttf',...
      'FontSize',8);
xlabel('Time (seconds)','FontSize',8);
ylabel('Displacement (mm)','FontSize',8);
L = legend(["x_0 = ", num2str(x0*1000,'%4.1f'), " mm    ",...
          "\nv_0 =  ", num2str(v0*1000,'%4.1f'), " mm/sec",...
          "\n  m =  ", num2str(m,'%4.1f'),       " kg    ",...
          "\n  c = ", num2str(c/1000,'%5.1e'),  " N-s/mm",...
          "\n  k = ", num2str(k/1000,'%5.1e'),  " N/mm  "])
FL1= findall(L,'-property','FontName');
FL2= findall(L,'-property','FontSize'); %this yields errors with my version
;-(
set(FL1,'FontName','/usr/share/fonts/msttcore/cour.ttf');
set(FL2,'FontSize',8);
H = 3; W = 4;
set(h,'PaperUnits','inches')
set(h,'PaperOrientation','portrait');
set(h,'PaperSize',[H,W])
set(h,'PaperPosition',[0,0,W,H])
print(h,'-dpng','-color','vib_plt4.png');



-----
A numerical poem:
Now the fifth daughter on the twelfth night
Told the first father that things weren’t right
My complexion she said is much too white
He said come here and step into the light, he says hmm you’re right
Let me tell the second mother this has been done
But the second mother was with the seventh son
And they were both out on Highway 61
("Highway 61" by Robert Zimmerman 1964)
--
View this message in context: 
http://octave.1599824.n4.nabble.com/searching-for-octave-plotting-templates-examples-tp4663628.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]