[SOLVED] matlab errors,defing vaiables

Status
Not open for further replies.

fareen

Full Member level 3
Joined
Oct 31, 2010
Messages
154
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,298
Activity points
2,193
hi
im having a lot of troble in writing matlab code
specially in defing a function

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
fu=function define in another function file.
function [bs] = bisection(fu, xl,xu,tol,n)
 
 
error=0;
t=0;
while t <= n | error < tol
    bs= xl+ (xu-xl)/2;
   
    if (fu(xl)*fu(bs))<0
        bs=xu;
    elseif (fu(xu)*fu(bs))<0
        bs=xl;
    else (feval(fu,xl)*feval(fu,bs))==0;
        break
    end
  
        error = (bs(t-1)-bs(t))/bs(t);
        if error < tol
            break
        end
        t=t+1;
   
end
 
        
end
function f=fu(x)
x=0:10;
 
f=x.^3+4*x-10;
end


can any body help??
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…