www.omatrix.com





:: O-Matrix ::
> Overview
> Examples
> Performance
> Analysis Functions
> Data Visualization
> The O-Matrix Language
> Data Manipulation/IO
> Application Development
> Using Matlab m-files




XLSURFACE.OMS

Script File:
# XLSurface.oms
# Automation Server: Microsoft Excel
# Create a 2D FFT in O-Matrix and generate surface plot in Excel
# 
local function create2DFFT() begin
	# total time, g(t1, t2) is "small" for |(t1, t2)| > T / 2
	T = 4.   
	N = 26
	dt = T / N       
	df = 1 / T       
	t = (seq(N) - N / 2 - 1) * dt 
	alpha = 5. 
	h = exp( - alpha * abs(t)) 
	g = fillcols(h, N) % fillrows(h', N) 
	# the continuous transform of g(t1, t2) is given by
	# G(f1, f2) = H(f1) * H(f2)
	# where H(f) = 2 * alpha / ((2 * PI * f)^2 + alpha^2)
	# is the discrete transform of g
	G = real(fft2d(complex(g))) * dt * dt 
	return G
end
# Transfer O-Matrix variable to Excel at the given range
local function putXLMat(matVar, range) begin
	cowith("Range", range)
	copropput("Value", matVar)
	coendwith
end
# Create a new Chart sheet with Surface plot
local function xlpltSurface(matVar, rng) begin
	cowith("ActiveSheet")
	putXLMat( matVar, rng )
	cowith("UsedRange")
	coinvoke("Select")
	coendwith
	coendwith
	cowith("Charts")
	coinvoke("Add")
	coendwith
	cowith("ActiveChart")
	copropput("ChartType", 83)
	coendwith
end
# script entry point
cocreate("Excel.Application")
copropput("Visible", 1)
cowith("Workbooks")  
coinvoke("Add")
coendwith()  
rng = "A1:Z26"
G = create2DFFT()
xlpltSurface(G, rng)
	  

Output:


Company |  Products |  Showcase |  Support |  Ordering
Copyright© 1994-2009 Harmonic Software Inc. - All rights reserved.