LeL us assume a reglon wlLh Lwo vlllages A and 8. 1helr poslLlons are (Ax, Ay) and (8x, 8y) respecLlvely. A road has Lo be bulld connecLlng Lhese Lwo vlllages. 8eLween Lhe Lwo vlllages flows a rlver, sLrlcLly ln wesL-easL dlrecLlon. 1he y-poslLlon of Lhe lower 8ank of Lhe rlver ls denoLed as yL8. 1he y-poslLlon of Lhe upper 8ank of Lhe rlver ls yu8. Cver Lhe rlver Lhere wlll be a brldge wlLh x-oslLlon of Lhe Lower end of Lhe 8rldge xL8 and x poslLlon of Lhe upper end of Lhe brldge xu8.
0 1 2 3 4 5 6 7 8 9 10 0 2 4 6 8 10 West-East-Position X[km] S o u t h - N o r t h - P o s i t i o n
Y [ k m ]
Village A Village B River Street AX xLB xUB BX BY yUB yLB Ay 2 Pere ls Lhe MA1LA8 code Lo generaLe Lhe ploL above (wlLhouL dlsplaylng Lhe varlable names) yUB=6; %y-position of upper bank yLB=4; %y-position of lower bank xL=0; %x-position of left boarder xR=10; %x-position of right boarder yL=0; %y-position of lower boarder yU=10; %y-position of upper boarder Ax=3; %x-position of City A Ay=2; %y-position of City A Bx=8; %x-position of City B By=7; %y-position of City B plot(Ax,Ay,'o','MarkerFaceColor',[1 0 0],'MarkerSize',15) hold on plot(Bx,By,'o','MarkerFaceColor',[0 1 0],'MarkerSize',15) fill([xL;xL;xR;xR],[yLB;yUB;yUB;yLB],'b') % replace these two lines by a brute force method xLB=5; xUB=6; %################################################ plot([Ax,xLB,xUB,Bx],[Ay,yLB,yUB,By],'k','LineWidth',4); xlabel('West-East-Position X[km]'); ylabel('South-North-Position Y[km]'); legend('City A','City B','River','Street') axis(gca,[0,10,0,10])
LeL us assume LhaL a brldge ls more expenslve per km Lhan ls a convenLlonal sLreeL per km. 1he raLlo of cosLs ls called 8. lor a glven 8 (ranglng from 1 Lo lnflnlLy) Lhe cheapesL paLh from A Lo 8 ls looked for.
3 -0'; )*+*+, WrlLe a MA1LA8 expresslon, LhaL calculaLes a normallzed lengLh nL. 1he normallzed lengLh nL ls Lhe lengLh of a sLreeL purely convenLlonal lnvoklng Lhe same cosLs as Lhe planned paLh from A Lo 8. (8aslcally you could also calculaLe Lhe cosL of Lhe sLreeL from A Lo 8. 8uL you are mlsslng Lhe lnformaLlon on Lhe cosL per km sLreeL over land.) 1he expresslon wlll be dependenL on Lhe followlng varlables: Ax, Ay, 8x, 8y, xL8, xu8, yL8, yu8, 8
-0'; )*+*<,
1ry all posslble roads from A Lo 8 wlLh sLeps ln x-dlrecLlon of 10 m.
Some assumpLlons:
1he cheapesL paLh from A Lo Lhe rlver ls a sLralghL llne. 1he cheapesL paLh from Lhe rlver Lo 8 ls a sLralghL llne as well. 1he cheapesL paLh Lhrough Lhe rlver ls - make an educaLed guess - : a sLralghL llne. ?ou can assume Lhe followlng relaLlons: Ax<8x Ay<8y Ax<=xL8 xL8<=xu8 xu8<=8x
llnd Lhe cheapesL road and show lL ln Lhe ploL!
PlnLs: 1he flnal code Lakes some Cu-Llme. SLarL wlLh a greaLer sLep ln x. 1esL your code and Lhen decrease Lhe sLep slze. Carefully Lhlnk abouL how small Lhe ranges of your loops can be.
-0'; )*+*=,
erform some plauslblllLy LesLs on Lhe resulLs obLalned! lor whlch values of 8 can you predlcL Lhe course of Lhe cheapesL sLreeL?
A mulLlple cholce LesL resembles 30 quesLlons wlLh 3 checkboxes each. lor each checkbox Lhere ls a 30 Lo 30 chance, LhaL lL has Lo be checked. A quesLlon ls only accepLed as correcL, lf all flve checkboxes of Lhls quesLlon are seL correcL.
See Lhe followlng examples:
1hls quesLlon would be raLed correcL, as all Lhe checkboxes are seL correcL. 3
1hls quesLlon ls raLed wrong, as Lhe lasL checkbox ls noL checked. 6
1hls quesLlon ls raLed wrong, as Lhe second lasL checkbox ls checked.
-0'; )*<*+ WrlLe code Lo slmulaLe Lhe resulL of a quesLlon, lf Lhe sLudenL has no knowledge aL all. (1he sLudenL [usL Lhrows a dle for each checkbox.) use 0 for a wrong checkbox and 1 for a correcL checkbox. -0'; )*<*< SlmulaLe 1000 sLudenLs each Laklng a LesL wlLh 30 quesLlons. All Lhe sLudenLs should have no knowledge buL [usL Lhrow a dle for each checkbox. CounL how many sLudenLs have aL leasL 4 quesLlons correcL!
7
!"#$%&'# )*=, @#0'7 AB30$# (Lhls homework wlll noL be graded)
Solve Lhe followlng sysLem of equaLlons ln Lhe leasL square sense: a+b+c+d=1 a+b+c+d=1.3 a+b+2c+4d=17 a+2b-3d+4c=28 -2a+3d+2c=18-4b 17+a=3b-4c+d