Skip to content

Instantly share code, notes, and snippets.

@maruta
maruta / gist:1035254
Created June 20, 2011 07:17
SYM2TF: a matlab function which converts symbolic math rationals to transfer function object
function [ tfobj ] = sym2tf( symobj, Ts)
% SYM2TF convert symbolic math rationals to transfer function
if isnumeric(symobj)
tfobj=symobj;
return;
end
[n,d]=numden(symobj);
num=sym2poly(n);
@maruta
maruta / AdaFruitSSD1351.cs
Created June 16, 2015 05:09
netduino driver for the color 128x128 OLED display referenced SSD1351
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
namespace Maruta
{
/// <summary>
/// This class is a driver for the color 128x128 OLED display referenced SSD1351.
/// http://www.adafruit.com/products/1431
@maruta
maruta / img2bin.py
Created June 16, 2015 05:21
Script for converting image file to binary file for SSD1351 OLED display
from PIL import Image
import numpy
infile="norain.png"
outfile="norain.bin"
img = Image.open(infile)
print(img.size)
pix= img.load()
@maruta
maruta / save_figure_with_size.m
Created June 22, 2015 04:57
Save MATLAB figure as image file with specified width and height
% Figure を 1024x768 のPNG形式で
% "fig.png" に保存する例
width = 1024;
height = 768;
set(gcf,'PaperPositionMode','auto')
pos=get(gcf,'Position');
pos(3)=width-1; % なぜか幅が1px増えるので対処
pos(4)=height;
set(gcf,'Position',pos);
print('-r0','-dpng','fig.png');
@maruta
maruta / latexmkrc
Last active December 2, 2019 03:53
my latexmkrc for Japanese tex document
#!/usr/bin/perl
$latex = 'platex %O -src-specials -shell-escape -interaction=nonstopmode -synctex=1 -kanji=utf8 %S';
$bibtex = 'pbibtex %O %B -kanji=utf8';
$dvipdf = 'dvipdfmx %O -o %D %S';
$pdf_mode = 3; # use dvipdfmx
@maruta
maruta / latexmkrc
Last active December 2, 2019 03:50
my latexmkrc for English document (windows)
#!/usr/bin/perl
$pdflatex = 'pdflatex -synctex=1 -src-specials -shell-escape -interaction=nonstopmode -halt-on-error -file-line-error %O %S';
$bibtex = 'bibtex %O %B';
$pdf_mode = 1;
@maruta
maruta / README.md
Last active November 16, 2016 10:12
Visualization of Citation Network around Machine Learning (+ Control Theory)

This is a visualization of citation network around machine learning and control theory.
This visualization is based on Citation Network Dataset by Aminer [1].

[1] Jie Tang, Jing Zhang, Limin Yao, Juanzi Li, Li Zhang, and Zhong Su.
ArnetMiner: Extraction and Mining of Academic Social Networks.
In Proceedings of SIGKDD'2008. pp.990-998.

% vector field
dxdt = @(x) [x(2);-x(1)];
% mesh
[GX,GY] = meshgrid(linspace(-2*pi,2*pi,100),linspace(-10,10,100));
% stream
DX = arrayfun(@(x,y) [1,0]*dxdt([x;y]),GX,GY);
DY = arrayfun(@(x,y) [0,1]*dxdt([x;y]),GX,GY);
[verts,averts] = streamslice(GX,GY,DX,DY,400);
@maruta
maruta / settings.json
Created December 2, 2019 02:29
LaTeX Workshop で素の Latexmk を呼び出すための settings.json への記述
{
// 他の設定の続きに以下の設定を追記,追記の際,区切りのカンマ(,)が必要な場合もあるので注意
"latex-workshop.latex.tools": [
{
"command": "latexmk",
"args": [],
"name": "latexmk"
}
],
"latex-workshop.latex.recipes": [
@maruta
maruta / doc.m
Last active March 12, 2020 13:55
MATLABでなぜかヘルプが表示できないときにパスの通るところにおいて使用
function [] = doc(s)
web(sprintf('https://google.co.jp/search?q=%s%s',urlencode(s),urlencode(' site:jp.mathworks.com')),'-browser')
end