Discussion Notes 4

Discussion Notes 4 - EME 5 Discussion 4 Function Random...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
EME 5 Discussion 4 Function Random Number Generation Define Macros Header, Function, and Application Files
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Function (a) Function prototype : returntype functionname(argumenttype [argumentname]); (b) Function definition : returntype functionname(argumenttype argumentname) { statements; return returnvalue; }
Background image of page 2
Function (contd.) (c) Common errors : 1) returnvalue does not have the type that matches returntype 2) functionname in definition does not match functionname in prototype 3) argumenttype/argumentname in definition does not match argumenttype/argumentname in prototype
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Function (contd.) In Ch, write a function that returns the value of f(x). Print the values of f(x) for -10<=x<=10 with x_step = 0.5. Plot f(x) with 50 points for x. f(x)=sin(x).
Background image of page 4
Function (contd.) Need: 1) for-loop 2) Ch plotting function fplotxy() int fplotxy(double (*func)(double), double x0, double xf, int num, char *title, char *xlabel, char *ylabel);
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Function (contd.) #include <math.h> #include <stdio.h>
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/21/2008 for the course EME 005 taught by Professor Cheng during the Fall '07 term at UC Davis.

Page1 / 12

Discussion Notes 4 - EME 5 Discussion 4 Function Random...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online