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




ROSEN.OMS

Script File:
# Description:
# Plots a surface of Rosenbrock's function.
#
clear
# Evaluate Rosenbrock's function on an x - y grid.
# size of grid in x direction
N = 21 
# size of grid in y direction
M = 21 
# column vector grid on [ -1.5, 1.5]
x = (seq(N) - 1) * 2. / (N - 1) - 1. 
# row vector grid on [ -1.5, 1.5]
y = (seq(M)' - 1) * 2. / (M - 1) - 1. 
# value of x for each matrix element
X = fillcols(x, M) 
# value of y for each matrix element
Y = fillrows(y, N) 
# value of Rosenbrock's function
R = ( 10 * (Y - X^2) )^2 + ( 1 - X )^2 
# avoid zero for log plotting
R = nozero(R, 1e-2) 
#
# Surface plot
# title for this viewport
gtitle("Rosenbrock's Function") 
# log scale the z axis
gzaxis("log", 1e-2, 1e+3) 
# use exponential format for z axis
gztick("e10.1")
# choose seven colors and six corresponding level values
color = { "red", "maroon", "lime", "green", "navy", "blue", "black"}
gcolor(color)
# contour and surface levels
level = 100 * (seq(6) / 6.)^2 
glevel(level)
# surface uses seven colors and six levels
# because color changes at each level
surface(R, "levels", x, y)
# contour uses six colors, one for each level
contour(R, level, x, y, 1e-2)
	  

Output:


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