11 views (last 30 days)
Victor on 17 Dec 2013
Answered: Roger Stafford on 18 Dec 2013
hi i need help writing a code that will allow the user to choose which of each of the intersections the user wants to solve for. these are the equations:
1: 100 + 200 = f1 + f3 or f1 + f3 = 300 (1)
2: 300 + f1 = f2 + f4 or −f1 + f2 + f4 = 300 (2)
3: f5 + f2 = 100 +500 or f2 + f5 = 600 (3)
4: f3 + f6 = 100 +300 or f3 + f6 = 400 (4)
5: f4 +f7 = f6 +200 or f4 − f6 + f7 = 200 (5)
6: 200 + 400 = f5 + f7 or f5 +f7 = 600 (6)
##### 2 CommentsShowHide 1 older comment
Victor on 17 Dec 2013
Edited: Walter Roberson on 18 Dec 2013
Assume that there is no traffic jam or stopped car anywhere. Then, at each intersection, the net traffic flow is zero. For example, at intersection 1, we have all the incoming traffic must be equal to the out going traffic: 100 + 200 = f1 + f3. Write down the equations for all the intersections. You can use MATLAB to study the following questions.
a) Is there enough number of equations to determine all the unknown traffic flows f1 to f7?
b) If not enough, you can suggest to add traffic sensors to measure some traffic flows such that you can determine all other traffic flows through the equations. Which traffic flows to measure? How many?
Assume that you have measured the necessary traffic flows you need and you know how to compute other traffic flows.
Program Requirement:
Your MATLAB program should ask for the measurements of the traffic flows that the user chooses, decide if they are the appropriate ones to measure (according to the dimension and rank of the matrix), and output the rest of traffic flows if the measurements are appropriate, otherwise, ask for the measurements of different traffic flow.
You should allow the user to install more than one traffic sensor. Your program should inform the user what the nature of the solution would be. Make sure that you review the part of lecture on solving linear algebraic equations for non-rectangular matrix. The program should also check for the repeated choices made by the user, and provide messages to inform the user that the choice was made before

Walter Roberson on 17 Dec 2013
Walter Roberson on 18 Dec 2013
As I read it, you need to allow the user to indicate a list of flows (each f1 to f7) and corresponding traffic volumes. Then, list entered, analyze to see whether the user has given enough information to solve the flows exactly; if not, say so and go back to the beginning. If the user gave too much information or gave flow measurements that make the whole system impossible, then say so and go back to the beginning. If the user gave just the right amount of information and it is not contradictory, spit out the list of all of the traffic flows; and then go back to the beginning.

Roger Stafford on 18 Dec 2013
I will give you one more hint on your problem, Victor. The part of the problem statement that says " according to the dimension and rank of the matrix " is an important indication of how you should proceed in writing your requested program. You need to figure out what matrix they are referring to and write your program to proceed accordingly.