MATLAB POLYSPACE RELEASE NOTES Bedienungsanleitung Seite 167

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 240
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 166
Scripts and Functions
The function plot_f han dle, shown below, receives a function handle and
data, generates y-axis data using the function handle, and plots it:
function x = p lot_fhandle(fhandle , data)
plot(data, fhandle(data))
When you call plot_fhandle with a handle to the sin function and the
argument shown below, the resulting evaluation produces a sine wave plot:
plot_fhandle(@sin, -pi:0.0 1:pi)
Function Functions
A class of functions called “function functions” works with nonlinear functions
of a scalar variable. That is, one function works on another function. The
function functions include
Zero finding
Optimization
Quadrature
Ordinary differen tial equations
MATLAB represents the nonlinear function by a function M-file. For example,
here is a si mplified version of the function
humps from the matlab /dem os
directory:
function y = h umps(x)
y = 1./((x-.3).^2 + .01) + 1./((x-.9).^2 + . 04) - 6;
Evaluate this function at a set of points in the interval 0 x 1with
x = 0:.002:1;
y = humps(x);
Then plot the function with
plot(x,y)
4-29
Seitenansicht 166
1 2 ... 162 163 164 165 166 167 168 169 170 171 172 ... 239 240

Kommentare zu diesen Handbüchern

Keine Kommentare