Iterations in matlab

  • Follow


i have been trying to solve a problem on dc series motor
the code i typed in my editor was as follows
%function [w]=speed(b0,w0,N)
%function [b]=current(b0,w0,N)
%for i = 1:N-1
%w(i+1)=[14.192*{(.1236*b(i)*b(i))-0.17}]+w(i);
%b(i+1)=[.05452*{40-(.1236*w(i)*b(i))-(7.2*b(i))}]+b(i);
%end
%plot(1:N,w)
%plot(1:N,b)

i defined bo w0 N in command window and then typed
[w]=speed(b0,w0,N)
i gt the error ??? Undefined function or method 'speed' for input arguments of type 'double'
please help..........
0
Reply aditya 12/3/2009 6:00:09 PM

aditya wrote:
> i have been trying to solve a problem on dc series motor
> the code i typed in my editor was as follows
> %function [w]=speed(b0,w0,N)
> %function [b]=current(b0,w0,N)
....
> i defined bo w0 N in command window and then typed
> [w]=speed(b0,w0,N)
> i gt the error ??? Undefined function or method 'speed' for
> input arguments of type 'double'

a) You put the % comment in front of each line defining the function
b) You gave no body content for the function speed if it wasn't a comment
c) ML looks for a file w/ the name of the function to resolve function 
calls so you need to save the code for each of the two functions in 
files named speed.m and current.m

Read the documentation in the "Getting Started" chapter/section on 
Programming and m-files...

--
0
Reply dpb 12/3/2009 6:55:34 PM


dpb <none@non.net> wrote in message <hf91js$gmq$1@news.eternal-september.org>...
> aditya wrote:
> > i have been trying to solve a problem on dc series motor
> > the code i typed in my editor was as follows
> > %function [w]=speed(b0,w0,N)
> > %function [b]=current(b0,w0,N)
> ...
> > i defined bo w0 N in command window and then typed
> > [w]=speed(b0,w0,N)
> > i gt the error ??? Undefined function or method 'speed' for
> > input arguments of type 'double'
> 
> a) You put the % comment in front of each line defining the function
> b) You gave no body content for the function speed if it wasn't a comment
> c) ML looks for a file w/ the name of the function to resolve function 
> calls so you need to save the code for each of the two functions in 
> files named speed.m and current.m
> 
> Read the documentation in the "Getting Started" chapter/section on 
> Programming and m-files...
> 
>the problem is that the two functions are interrelated and the second iteration of    w(2) cannot proceed without the computation of both w(1) and b(1) in first iteration
hence i want to ask about the procedure to declare both interelated functions simultaneously.If i remove function current from the code ..how do i declare the second function current becoz both have to be in the iterations simultaneously..
please help urgent...btw % ws jt fr demo tht its written in editor..thnx in advance to ani1 who helps
0
Reply aditya 12/3/2009 9:38:19 PM

aditya wrote:
....

> hence i want to ask about the procedure to declare both interelated
functions simultaneously.If i remove function current from the code
...how do i declare the second function current becoz both have to be in
the iterations simultaneously..
....

There's no such thing as "declared simultaneously" -- whichever function 
is invoked runs and returns to its caller when it has run to completion.

If one of these needs to call the other, that's fine; there just has to 
be some sort of logic to prevent an infinite loop such as a convergence 
criterion or somesuch.

--
0
Reply dpb 12/3/2009 9:44:53 PM

w(i+1)=2000[(0.05 (B(i)^2)) -1.5905]+w(i)
B(i+1)=166.67[-0.5 B(i) -0.05 w(i) B(i) +220]+B(i)
simple iterations jst wanna plot it ...can u suggest ani simpler way to solve this problem (preferably without function calling)
thnnx for help .........
0
Reply xingsan01 (1) 12/3/2009 9:57:20 PM

w(i+1)=2000[(0.05 (B(i)^2)) -1.5905]+w(i)
B(i+1)=166.67[-0.5 B(i) -0.05 w(i) B(i) +220]+B(i)
simple iterations jst wanna plot it ...can u suggest ani simpler way to solve this problem (preferably without function calling)
thnnx for help .........
0
Reply aditya 12/3/2009 10:12:03 PM

5 Replies
157 Views

(page loaded in 0.103 seconds)

Similiar Articles:













7/24/2012 7:06:14 AM


Reply: