help-octave
[Top][All Lists]
Advanced

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

RE: Formatted Output bug


From: dastew
Subject: RE: Formatted Output bug
Date: Mon, 17 Aug 2009 03:29:50 +0000




Date: Sun, 16 Aug 2009 19:44:55 -0700
From: address@hidden
Subject: RE: Formatted Output bug
To: address@hidden

thanks for the prompt reply. I still find it odd that it would print the first array and then the second array when i have clearly specified the order etc. Thanks for the tip to correct it

You are welcome.

I don't know if this is a bug or is the desired effect.
 But at least you have it working now.
Doug


--- On Mon, 17/8/09, address@hidden <address@hidden> wrote:

From: address@hidden <address@hidden>
Subject: RE: Formatted Output bug
To: address@hidden, address@hidden
Received: Monday, 17 August, 2009, 1:11 AM




From: address@hidden
To: address@hidden; address@hidden
Subject: RE: Formatted Output bug
Date: Sun, 16 Aug 2009 14:52:35 +0000




Date: Sun, 16 Aug 2009 01:27:42 -0700
From: address@hidden
Subject: Formatted Output bug
To: address@hidden

I was running this simple m-file.
I think there is a bug in the printf statement. It simply cannot print two variables correctly. The second variable is always wrong. I can print them separately and it works. It has me baffled.

Ubuntu 9.04,

QtOctave version 0.7.4

Octave 3.0.1



mass=1500*[1 0 0 0;0 2 0 0;0 0 2 0;0 0 0 3]

stiff=800e3*[1 -1 0 0;-1 3 -2 0;0 -2 5 -3;0 0 -3 7]

mr=sqrtm(mass);

kt=inv(mr)*stiff*inv(mr);

[v,d]=eig(kt);

w=sqrt(d);

w=w*[1;1;1;1];

w=w./(2*pi)

T=1./w

printf("Natural Frequency = %.2f Hz \n" ,w)

printf("Period = %.2f Hz \n" ,T)

printf("Natural Frequency = %f Hz Period= %f \n", w ,T )



Find local businesses and services in your area with Yahoo!7 Local. Get started..


On my ubuntu i get this
octave-3.0.1:14>
octave-3.0.1:14> printf("Natural Frequency = %.2f Hz \n" ,w)
Natural Frequency = 1.73 Hz
Natural Frequency = 3.85 Hz
Natural Frequency = 5.34 Hz
Natural Frequency = 7.26 Hz
octave-3.0.1:15>
octave-3.0.1:15> printf("Period = %.2f Hz \n" ,T)
Period = 0.58 Hz
Period = 0.26 Hz
Period = 0.19 Hz
Period = 0.14 Hz
octave-3.0.1:16>
octave-3.0.1:16> printf("Natural Frequency = %f Hz Period= %f \n", w ,T )
Natural Frequency = 1.727485 Hz Period= 3.854267
Natural Frequency = 5.338151 Hz Period= 7.261830
Natural Frequency = 0.578876 Hz Period= 0.259453
Natural Frequency = 0.187331 Hz Period= 0.137706
octave-3.0.1:17>

It is using all the w array first and then all the T array.

Doug Stewart



You cold try

q=[w T]'
octave-3.0.1:16> printf("Natural Frequency = %f Hz Period= %f \n", q )
Natural Frequency = 1.727485 Hz Period= 0.578876
Natural Frequency = 3.854267 Hz Period= 0.259453
Natural Frequency = 5.338151 Hz Period= 0.187331
Natural Frequency = 7.261830 Hz Period= 0.137706
octave-3.0.1:24>



Find local businesses and services in your area with Yahoo!7 Local. Get started.

reply via email to

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