Prev: glmfit of binomial data: weights
Next: why doesn't turning off handle visibility work in clabel?
From: anant on 26 Jul 2010 07:10 Hi, we have expression like: r1='(1-a0^2)*cos(t)+a0*cos(2*t)'; we have to remove the term of cos(t) and store the coefficients of it for further use. I did like; [coef,rest]=strtok(r1,'cos(t)'); rest=rest(10:end); it gives rest=a0*cos(2*t) and coef=1-a0^2; But,it is not necessary that matlab return the expression like that we have written. Means,some time it gives like r=a0*cos(2*t)+(1-a0^2)*cos(t) or some other order. How can we store the coefficient if expression is not written properly.\ I am using matlab 5.3
From: us on 26 Jul 2010 07:57 "anant " <kant85.shukla(a)gmail.com> wrote in message <i2jqed$f94$1(a)fred.mathworks.com>... > Hi, > we have expression like: > > r1='(1-a0^2)*cos(t)+a0*cos(2*t)'; > > we have to remove the term of cos(t) and store the coefficients of it for further use. > > I did like; > > [coef,rest]=strtok(r1,'cos(t)'); > > rest=rest(10:end); > > it gives rest=a0*cos(2*t) and coef=1-a0^2; > > But,it is not necessary that matlab return the expression like that we have written. > > Means,some time it gives like > > r=a0*cos(2*t)+(1-a0^2)*cos(t) or some other order. > > How can we store the coefficient if expression is not written properly.\ > > I am using matlab 5.3 hmm... what ...exactly... is wrong with your solution(?)... us
From: Walter Roberson on 26 Jul 2010 09:57 anant wrote: > we have expression like: > > r1='(1-a0^2)*cos(t)+a0*cos(2*t)'; > > we have to remove the term of cos(t) and store the coefficients of it > for further use. > > I did like; > > [coef,rest]=strtok(r1,'cos(t)'); > > rest=rest(10:end); > > it gives rest=a0*cos(2*t) and coef=1-a0^2; > > But,it is not necessary that matlab return the expression like that we > have written. > > Means,some time it gives like > > r=a0*cos(2*t)+(1-a0^2)*cos(t) or some other order. > > How can we store the coefficient if expression is not written properly.\ > > I am using matlab 5.3 That's a fairly old version of Matlab. Do you have the symbolic toolbox? (If you do it would be the Maple-based one.)
From: anant on 28 Jul 2010 02:29 Walter Roberson <roberson(a)hushmail.com> wrote in message <ivg3o.49157$Ls1.44878(a)newsfe11.iad>... > anant wrote: > > > we have expression like: > > > > r1='(1-a0^2)*cos(t)+a0*cos(2*t)'; > > > > we have to remove the term of cos(t) and store the coefficients of it > > for further use. > > > > I did like; > > > > [coef,rest]=strtok(r1,'cos(t)'); > > > > rest=rest(10:end); > > > > it gives rest=a0*cos(2*t) and coef=1-a0^2; > > > > But,it is not necessary that matlab return the expression like that we > > have written. > > > > Means,some time it gives like > > > > r=a0*cos(2*t)+(1-a0^2)*cos(t) or some other order. > > > > How can we store the coefficient if expression is not written properly.\ > > > > I am using matlab 5.3 > > That's a fairly old version of Matlab. > > Do you have the symbolic toolbox? (If you do it would be the Maple-based > one.) Yes,we have symbolic toolbox.
|
Pages: 1 Prev: glmfit of binomial data: weights Next: why doesn't turning off handle visibility work in clabel? |