help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Values of V and abm


From: Jaroslav Hajek
Subject: Re: Values of V and abm
Date: Mon, 9 Jun 2008 13:36:55 +0200

On Mon, Jun 9, 2008 at 1:15 PM, asha g <address@hidden> wrote:
> Yes the end closes the for loop.
> I wanted abmm to store all values of the iteration - not just the last one.  
> So I wrote that. Maybe there is a better way of writing it.

Indeed, because your way is incorrect. The assignments
abmm(iter,:)= abm;
abnn(iter,:)= abn;
abhh(iter,:)= abh;
are not performed inside the loop, so abmm(1:niter-1,:) will contain zeros.

> But more importantly, what is the bit abt not passing the arguments?
That was about the warning. Most likely you pass matrix where a scalar
is expected. Probably in your own oct-files, if you use any. Cannot
tell without reproducing the bug.

> I am sending the entire script file by attachment. But as there are many 
> function files to it- it might still be hard to debug.

I'm sorry, unless you provide enough code to *reproduce* the bug (that
means all user functions that are called in your code, and all data
files that are read), I'm afraid I can't offer more than guesses. If
you don't want to provide all the code, you can try to reduce the code
to a minimum stub that still triggers the bug. This is even better as
it helps others.


> thanks
> asha
>
>> > I am having some problems in a program I have written.
>> It is pretty long. But the section is :
>> >
>>
>> It's usually not much useful posting code that
>> can't be used to
>> reproduce the bug.
>>
>> > N = 10;
>> > niter = 10000;
>> > for iter = 1: niter
>> >
>> > [P,S] = timedepcabactoct(Q,V,h2,Iion,deltaT);
>> > for jj = 2:N-1
>> > V(jj) = S(jj);
>> > end
>> > if deltaT*niter < 5
>> > I = 0;
>> > elseif 5 == deltaT*niter <= 55
>> > I = 48.4*10^-12;
>> > V(1) = V(2)+(Ri/Ao)*I*hd;
>> > V(N) = 4/3*V(N-1)-(1/3)*V(N-2);
>> > end
>> > disp(V)
>> > calling function ratcon2oct
>> > [alphan,betan,alpham,betam,alphah,betah] =
>> ratcon2oct(V);
>> > abm = alpham +betam;
>> > m = m+(deltaT.*(alpham -m.*abm));
>> > abh = alphah + betah;
>> > h = h +(deltaT.*(alphah-h.*abh));
>> > abn = alphan + betan;
>> > n = n + (deltaT.*(alphan-n.*abn));
>> > end
>>
>>     ^ If I've followed the code correctly, then this
>> end corresponds
>> to the for iter=... loop.
>> Therefore, iter in the following statements has the value
>> niter. Is
>> this intentional?
>>
>> > abmm(iter,:)= abm;
>> > abnn(iter,:)= abn;
>> > abhh(iter,:)= abh;
>> > abm1= abmm(iter,1);
>> > t = (1:niter)*deltaT;
>> > plot(t,abm1)
>> >
>> > warning: implicit conversion from real matrix to real
>> scalar
>> >
>>
>> If this is warning from your oct-file, then you're
>> probably passing in
>> wrong arguments.
>> Again, it is hard to tell unless you give enough code to
>> reproduce the bug.
>>
>> >
>> > I need to get an oscillating plot of abm1, abn1 and
>> abh1 vs t. But I don't. Instead I get the warning given
>> above which I don't follow. Also, if I try to check V at
>> the point indicated I get the vector V repeated (N-2) times
>> before the values change. I would have expected it to
>> change at every iter count. Please tell me if I am writing
>> the loop incorrectly.
>> >
>> > Thanks
>> > Asha
>> >
>> >
>> >
>> > _______________________________________________
>> > Help-octave mailing list
>> > address@hidden
>> > https://www.cae.wisc.edu/mailman/listinfo/help-octave
>> >
>>
>>
>>
>> --
>> RNDr. Jaroslav Hajek
>> computing expert
>> Aeronautical Research and Test Institute (VZLU)
>> Prague, Czech Republic
>> url: www.highegg.matfyz.cz
>
>
>



-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


reply via email to

[Prev in Thread] Current Thread [Next in Thread]