Ubuntu 管理心得

搜尋此網誌

顯示具有 Octave 標籤的文章。 顯示所有文章
顯示具有 Octave 標籤的文章。 顯示所有文章

2023年8月13日 星期日

Octave multiple arguments for function handle

Suppose myfunc.m is:
 
function y=myfunc(x,a,b)
y=x+a+b;
endfunction


Use the command for example:

quad( @(x) myfunc (x, 1, 2),0,1) 

It outputs the quad integraion of myfunc from 0 to 1 with the argument a=1, b=2.


2023年4月21日 星期五

Resolve the error while making octave: uic: Unknown option 'qt'.

Make sure the shell is not within the Anaconda environment. For example:

(base) chiao@kpchiao9600k-2204:/download/Octave/octave-8.2.0$ make

It gets the error:

...

uic: Unknown option 'qt'.

Being inside the Anaconda environment can lead to a make error as Anaconda has multiple "uic" options. These include:

./anaconda3/pkgs/pyqt-5.15.7-py310h6a678d5_1/lib/python3.10/site-packages/PyQt5/uic

./anaconda3/pkgs/qt-main-5.15.2-h327a75a_7/bin/uic

./anaconda3/lib/python3.10/site-packages/PyQt5/uic

./anaconda3/bin/uic

To resolve this error, make sure you are in a regular shell, outside of the Anaconda environment, before running the "make" command. For example

chiao@kpchiao9600k-2204:/download/Octave/octave-8.2.0$ make


2022年7月12日 星期二

Octave plot and print with latex code

#Maybe need to do this first:
#sudo ln -s /usr/bin/latex /usr/local/bin

x = 1:10;
plot (x, x.^2)
title ("$x^2$", "interpreter", "latex")
print -svgconvert 'test_latex.pdf'

2021年5月24日 星期一

plot linestyle legend fontsize

The following octave commands:

plot(x,[ymat(:,[1,2,4])],{"k-.","k-","k:"},"linewidth", 2)
set(gca,'fontsize',26)
axis([1,6,-20000, 120000])
title(['Health People with minimum t-norm for dpercent=0.05'])  
xlabel('time interval (month)')
ylabel('People (in thousands)') 
yticklabels({"-20","0","20","40","60","80","100","120"})
legend ({"upper bound", "modal value", "lower bound" }, "location", "northeast")
grid on

produce the graph:



2021年1月17日 星期日

Remove duplicated octave icon in unity dash

 Delete the file: /usr/local/share/applications/www.octave.org-octave.desktop

2018年8月11日 星期六

Octave produce blank fig (xfig) file in ubuntu 18.04

I have a post in http://octave.1599824.n4.nabble.com/Cannot-produce-fig-file-td4687972.html#a4688009.

The reason why fig cannot be created is due to the bug in ghostscript 9.22.  
I found a solution (temporarily) in ubuntu 18.04. The steps are:
  1. Download the ghostscript 9.23  here
  2. Untar it at, say, /foo/.
  3. sudo mv /usr/bin/gs /usr/bin/gs_orig_922
  4. sudo ln -sf /download/Ghostscript/ghostscript-9.23-linux-x86_64/gs-923-linux-x86_64 /usr/bin/gs
  5. Done!

網誌存檔