Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Matrix

Subject: Matrix

From: Barry

Date: 18 Aug, 2010 12:47:23

Message: 1 of 4

A= 48x365 array of data ranging from 150-1000.
B= 1x365 ranging from 1-10
C= 1x365 data ranging from 20-35
F= 300

What I want to end up with is 48x365.
I want to add values=F to A starting at the number in the matrix B for h rows.
I want to subtract values from A starting at C for m rows.
I Also want the sum of A to be equal to the sum of C and i don't want A to be negative ever.

So F x h = m x whatever value, it can be constant but if it gets too large subtracting it will turn A negative

So what i am trying to do is simulate storage If anybody could help me with constant number it would be very helpful and also any ideas on how to go about increasing it and keeping it at either 0 or above

Subject: Matrix

From: Steven_Lord

Date: 18 Aug, 2010 13:09:52

Message: 2 of 4



"Barry " <barryoconnell2@gmail.com> wrote in message
news:i4gkor$qom$1@fred.mathworks.com...
> A= 48x365 array of data ranging from 150-1000.
> B= 1x365 ranging from 1-10
> C= 1x365 data ranging from 20-35
> F= 300
>
> What I want to end up with is 48x365.
> I want to add values=F to A starting at the number in the matrix B for h
> rows.
> I want to subtract values from A starting at C for m rows.
> I Also want the sum of A to be equal to the sum of C and i don't want A to
> be negative ever.
> So F x h = m x whatever value, it can be constant but if it gets too large
> subtracting it will turn A negative
>
> So what i am trying to do is simulate storage If anybody could help me
> with constant number it would be very helpful and also any ideas on how to
> go about increasing it and keeping it at either 0 or above

In this case, an example (a SMALL one, please) is worth a thousand words.
Show a sample A, B, C, and F and describe both what the end result of the
computations should be for that sample data as well as the steps you
followed to obtain that end result.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Matrix

From: Andy

Date: 18 Aug, 2010 13:17:27

Message: 3 of 4

"Barry " <barryoconnell2@gmail.com> wrote in message <i4gkor$qom$1@fred.mathworks.com>...
> A= 48x365 array of data ranging from 150-1000.
> B= 1x365 ranging from 1-10
> C= 1x365 data ranging from 20-35
> F= 300
>
> What I want to end up with is 48x365.
> I want to add values=F to A starting at the number in the matrix B for h rows.
> I want to subtract values from A starting at C for m rows.
> I Also want the sum of A to be equal to the sum of C and i don't want A to be negative ever.
>
> So F x h = m x whatever value, it can be constant but if it gets too large subtracting it will turn A negative
>
> So what i am trying to do is simulate storage If anybody could help me with constant number it would be very helpful and also any ideas on how to go about increasing it and keeping it at either 0 or above

I don't know how you could possibly expect anybody to follow this explanation. Why is B 1x365 in your initial list of variables, and then a "number" in your description? What are h and m? What does "starting at C" mean when C is a 1x365 array? How can the sum of A (which will be 1x365) and the sum of C (which will be a single number) be equal? And "F x h = m x whatever value" makes no sense at all.

Please show the code you've come up with so far. Give a small sample of input (make A no larger than, say, 10x10, and choose small B, C, and F as well), and tell us what your desired output would be for that input. Show the steps of your algorithm (in code or pseudocode, not in words). Otherwise, nobody has a chance of helping you.

Subject: Matrix

From: Barry

Date: 18 Aug, 2010 13:33:24

Message: 4 of 4

What I have is electricty price data for 48 hours 365 days ie 48x365 I also have an electrcity demand which is 48x365.

What i have done is found the cheapest time to store electricty for 6 hours and most advantageous time to discharge the storage 5 hours.

Simplified version A = (48x2) Elec price

120 150
240 250
360 300
200 100
250 150
300 270
700 500
100 200
  . .
  . .
  . .

B = (48x2) Elec demand

120 158
255 250
360 300
600 250
250 150
250 270
100 505
400 210
  . .
  . .
  . .

So lets say i determine the cheapest consecutive 6 hours of A gives me another matrix C. Which is when the cheapest 6 consecutive hours begin

C
3 4


What i want to do is add on a value lets say 100 to B starting at row 3 for 6 consecutive rows in column 1 and add on 100 to B starting at row 4 for 6 consecutive rows.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us