Google

main
dspblog
cyclic_signals
FFT_interpolation
FFT_interpolation_how_does_it_work
FFT_smoothness_cyclic
discrete_time_reconstruction
discrete_time_reconstruction2
Nyquist_on_the_edge
FFT_delay_special_case
Fourier_reconstruction
pulse_and_Nyquist
FFT_complexError
matlabOctave
matlab_upsampling
matlab_downsampling
FFT_delay
FFT_filter_example
FFT_interpolation_example
FFT_bin_frequencies
fit_signal
FFT_peaksearch_audio_example
matlab_binary_readwrite
Octavesvg
C
FFTW_example
looprecord
SNR
SNR3
SNR_example_96kAudio
SNR_FFT_correlation_example
lua
luagpib
luasplit
luadump
mnoofltk
wxLuaDll
wxLua_loadAsDll
wxLua_HelloWorld
wxLua_simpleButton
wxLua_resourceManagement
wxLua_XMLparser
DSP
IQ_LO
IQ_LO_2
optimum_receiver
DSP_basics
sampleRateChange_terms
dirac_pulse
freqresp_s
zfilter_example
freqresp_z
freqresp_z_sign
misc
zero_forcing_equalizer_example
nonminphase_inverse
periodic_spectrum
lagrange_multipliers
Entropy
RC_chopper
TRex450_setup
EP100
EP100SE
EP100Gremlins
essential_spares
tail_rotor
motoradjustment
blade_balancing
blade_repair
GAUI_SAE12A
Walkera43


valid html (click to verify)



prevupnextdisable ads

SVG generation from Matlab / Octave

Summary

Some Matlab / Octave routines to create scalable vector graphics (SVG) output
When writing technical documentation, it is often useful to generate graphics using Matlab or Octave.
They are then imported into a vector graphics program and edited further.
Here is a compact example that generates an SVG image (scalable vector graphics).
The image can then be further edited using a vector graphics drawing program such as Inkscape.

Downloading the example

  • Download the zip archive
  • Unzip to c:\temp (or anz other folder)

Running the demo

  • From the Matlab / Octave command line, type
    addpath('c:/temp')
  • type
    svgdemo
  • The demo writes its output to c:\temp\test.svg.
  • Drag-and-drop c:\temp\test.svg into a web browser for viewing
  • In the web browser, use the reload button after re-running the example
  • Drag-and-drop into Inkscape (or another vector graphics program) for editing

Example

Demo program (included)

fid=svgheader('c:/temp/test.svg');
indep=0:0.001:1;
x=indep*600;
y1=100+100*sin(indep*2*pi);
y2=100+100*cos(indep*2*pi);
y3=100+100*sin(2*indep*2*pi);
y4=100+100*cos(2*indep*2*pi);
svgline(fid, x, y1, 'stroke', 'red');
svgline(fid, x, y2, 'stroke', 'green');
svgline(fid, x, y3, 'stroke', 'blue');
svgline(fid, x, y4, 'stroke', 'black');
svgfooter(fid);

Result


Opening test.svg will render the SVG file in your browser, if it supports the format.

Going further

It is fairly easy to generate other SVG shapes from Matlab/Octave.
Here is a list of further examples.
The official SVG reference manual is here.
A list of color names can be found here. The previous link also explains hex notation, as for example #ff0000 for red.


prevupnextdisable ads

© Markus Nentwig 2007-2008
The content of this page is provided without any warranty and may not be reproduced without permission.

Comments? Questions?

Please send me a mail! mnentwig@elisanet.fi