I have to compile the function but my matrix dimensions are not equal.
Show older comments
clear all close all clc
t=-10:0.1:10; w=input('enter the value of w'); b=input('enter the value for b'); f=zeros(1,length(t));
for i=1:length(t)
f(i)=f+(1./(1+exp(w(i).*t(i)+b(i))));
end
5 Comments
Phillip
on 19 Jun 2014
Hi
You are looping over w(i) and b(i). Are they suppose to be vectors or scalars?
Regards, Phillip
Mariam 123
on 19 Jun 2014
Mariam 123
on 19 Jun 2014
Phillip
on 19 Jun 2014
I was trying to point out that in the code above w and b are scalars but you are treating them like vectors (w(i) & b(i)) in the for loop.
If they are suppose to be scalars then the answer below is what you are looking for. If not, then you need to be a bit more clear on what the inputs are
Mariam 123
on 19 Jun 2014
Answers (1)
Andrei Bobrov
on 19 Jun 2014
t = -10:0.1:10;
w = input('enter the value of w = ');
b = input('enter the value for b = ');
f = cumsum(1./( 1 + exp(w*t + b) ));
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!