Error - Error in inline expression ==> x^2e^(-x^2) ???...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
>> %This program uses the Composite Trapezoidal Rule to approximate the integral% >> a=0; b=2; h=.25; n=8; %These are the initial values given to approximate the integral % >> sum = 0; >> f = inline ('x^2e^(-x^2)') f = Inline function: f(x) = x^2e^(-x^2) >> for i=0:n, x = a + i*.25; f = f(x); if i==0 | i ==n, sum = sum + .5*f; else sum = sum +f; end; end; ??? Error using ==> inlineeval
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Error in inline expression ==> x^2e^(-x^2) ??? Error: Expected a variable, function, or constant, found "incomplete floating-point number". Error in ==> C:\MATLAB6p5\toolbox\matlab\funfun\@inline\subsref.m On line 25 ==> INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr); >>...
View Full Document

This note was uploaded on 05/01/2009 for the course PSTAT 120A taught by Professor Mackgalloway during the Spring '08 term at UCSB.

Ask a homework question - tutors are online