Suppressing Output MATLAB
My code output gives me if, exact_answer, and then a vector output with N entries. I am unsure how to suppress that entry. For example, it looks like the following:
exact_answer =
0.2642
If =
0.1882
ans =
0 0.1637 0.2681 0.3293 0.3595 0.3679
I don't want the answer output. -
function g = LaplaceTransform(s,N)
% define function parameters
a=0;
b=1;
h=(b-a)/N;
x = 0:h:1;
% define function
g = ff(x).*exp(-s*x);
% compute the exact answer of the integral
exact_answer=antiderivative(b,s)-antiderivative(a,s)
% compute the composite trapezoid sum
If=0;
for i=1:(N-1)
If=If+g(i).*h;
end;
If=If+g(1).*h/2+g(N).*h/2;
If
ans
shows up because you call
LaplaceTransform(bla, blabla)
instead of
LaplaceTransform(bla, blabla);
(you lack a semicolon when you call the function).
exact_answer
shows up because your line
exact_answer=antiderivative(b,s)-antiderivative(a,s)
lacks a semicolon as well, you should have
exact_answer=antiderivative(b,s)-antiderivative(a,s);