%DEFINING A FUNCTION and PLOTTING
%(Selcuk Bayin, METU-NCC, bayin@metu.edu.tr)
clc
sqr = @(x) x.^2
root= @(x) x.^(1/2)
x = 1:1/10:10;
plot(x,x.^(1/2))
%%
y=@(x) x.^(1/2).*sin(x)
plot(x,x.^(1/2).*sin(x))
grid
%%
%VALUE OF A FUNCTION
root(25)
%%
sqr(2)
%INLINE FUNCTIONS
%%
clc
f=inline('(1/2)*(x.^2+y.^2)','x','y')
f(2,2)
%%
%WORKS ALSO WITH ARRAYS
clc
A=[1,2;3,4]
B=ones(size(A))
C=f(A,B)

