| View previous topic :: View next topic |
| Author |
Message |
Wiggly Guest
|
Posted: Wed Jan 07, 2004 8:19 am Post subject: Simple Matrix Calculation Problem |
|
|
Hi,
I think this is a really simple problem but I have no idea why it is happening. I am about to go and write a program to do it for me but I'm sure spreadsheets should be able to do this. In fact, I kind of got OO Calc to do this but now it refuses again.
I'm a programmer, not a spreadsheet expert so please bear that in mind.
I have a very simple calculation to do. I have a set of values (my x-axis) that, lets say, represents time. Another set of values (my y-axis) that, lets say, represents miles per hour.
If I want to create a data point representing the distance travelled at each time/speed then how would I go about it?
I have tried using the method described in the help files referring to 'Entering Matrix formulas' but after working once it does not seem to work anymore.
Is this the right method? Should I be doing something else?
Right, off to throw together a Perl script and a gnuplot script if this doesn't work soon.
Cheers,
w |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
Posted: Wed Jan 07, 2004 11:45 am Post subject: |
|
|
I don't understand exacly what you want to do with matrix
if your x-axis represents time and your y-axis represents speed and you want distance you have a discrete integration to do. Normaly it's not a discrete operation and then you have to choose how to compute your integration ? Suppose for instance you have
t v d
O 2
1 2
3 3
4 3
You can make hypothesis that the first row means from t=0 to t=1 I have a speed of 2
the second row from t=1 to t=3 I have a speed of 2 ...
Then to compute the distance :
first row : 1x2 ( in a sheet =(A3-A2)*B2) it's v.Dt where Dt = ti - ti-1
second row :2*2+1x2 (in a sheet =(A4-A3)*B3 +C2 )
you can drop this last formula but not till the last row because (A6 in my example) doesn't exist. Perhaps are you surprise by this fact : I can't compute the last row. But ask you what does mean your last row with your hypothesis ? That between ???? and 4 my speed is 3 and then how compute a distance ?
If i am not clear enough ask more ... _________________ Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide |
|
| Back to top |
|
 |
Wiggly Guest
|
Posted: Wed Jan 07, 2004 4:47 pm Post subject: |
|
|
Hi, thanks for the reply. Maybe I picked a bad example.
Say I eventually want to plot the distance travelled, over time, at a set of different speeds.
I might have one set of data points to represent the time intervals I'm interested in, lets say our time is measured in minutes and I want 60 intervals.
Say I want to plot graphs for three different speeds, 10miles/min, 20miles/min and 30miles/min.
Now all I want to do is to get Calc to take those numbers and generate the actual distances travelled at each time interval, for each speed. So for the first speed my data points that I want plotted are;
10,20,30,40,50,60,70...600
I have been trying to get Calc to do this initially so that I can then plot the data in a graph but I'm having trouble getting it to produce this data for me. |
|
| Back to top |
|
 |
uros Super User


Joined: 22 May 2003 Posts: 601 Location: Slovenia
|
Posted: Thu Jan 08, 2004 6:11 am Post subject: |
|
|
Hi Wiggly!
I'm not sure if I understand your problem correctly. From your second post I asume that speed is constant all the time for one set of data - one row. In second row is different speed, but also constant all the time. If this is true, there is a very simple solution, multply two numbers.
Let's say you have tho following table:
.....A B C D E
1......1 2 3 4
2 10
3 20
4 30
There are speeds in miles/minute in column A and time in minutes in first row.
In cell B2 type: = $A2 * B$1
and copy formula in all cells thru E4.
You'll get this:
.....A B C D E
1......1 2 3 4
2 10 10 20 30 40
3 20 20 40 60 80
4 30 30 60 90 120
If you add another speed in next row, you'll have to copy formulas.
But, as I said at start, I don't know if this is realy your problem. It is too simple.
Uros |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
Posted: Thu Jan 08, 2004 6:31 am Post subject: |
|
|
I think the formula is tha same but more difficult to drag it.
I suppose that the first column is time (and not time interval) (I am not sure of what you consider here) A2=1, A3=2, A4=3, ...A61=60
I suppose the second column contain 3 speeds B2=10, B3=20, B4=20
I want to compute the three distances in 3 columns C, D and E
in C2 comes =(A3-A1)*B1
in C3 comes =(A4-A3)*B1 + C2
in C4 comes =(A5-A4)*B1 + C3 .... and so on. When you drag this formula it doesn't maintain B1 !
in D2 comes =(A3-A1)*B2
in D3 comes =(A4-A3)*B2 + D2
in D4 comes =(A5-A4)*B2 + D3 ....
in E2 comes =(A3-A1)*B3
in E3 comes =(A4-A3)*B3 + E2
in E4 comes =(A5-A4)*B3 + E3 ....
If you want to drag your formula the better way, I think, is to write a column with first speed, a column with the second speed ... and to compute like the previous post. _________________ Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|