My question is - How do I visualize these two functions ; .
For the first one, I've tried -
x=-2:0.1:2;
f=@(x)1/1+x.^2
plot(x,f(x))
And MATLAB doesnt allow me to place
1+x.^2
in parentheses. MATLAB tells me - 'Inner matrix dimensions must agree.'. Same issue with second function.
答案 0 :(得分:4)
Division needs to be pointwise, too. So you should do
x=-2:0.1:2;
f=@(x)1./(1+x.^2)
plot(x,f(x))