clf;(adsbygoogle = window.adsbygoogle || []).push({});

clear all;

syms x

%t=linspace(0, pi);

%x=t;

f=@(x) exp(-x).*cos(2*x)

h1=ezplot(f,[ 0, pi]); %plots the function f

f(pi./4)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

My output gives me:

f =

@(x)exp(-x).*cos(2*x)

ans =

2.7918e-017

%%%%%%%%%%%%%%%%%

But, the real answer is 0.

I'm clueless. Please, help.

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Obvious Result Wrong in Matlab

**Physics Forums | Science Articles, Homework Help, Discussion**