Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Prob 2. 30pts There are seven train stations along a train line. The distances between each station and the first station are [0 12 28

image text in transcribed
Prob 2. 30pts There are seven train stations along a train line. The distances between each station and the first station are [0 12 28 44 56 80 91), respectively, in miles. If the train fair rate is $2 per mile, write a Matlab program to calculate and print a train fair table as shown below. Each row of the table corresponds to one origin station, and each column corresponds to one destination station. Make use of '%xd' in the fprintf function to specify the field width x for integer printing. Note that x is a number you need to identify. Use for loops and build upon the table printing example in class to complete the problem. You are allowed to use the built-in functions zeros, length, and abs, which calculates the absolute value. Command Windou for Getting Started 112160182 1 | 56 | 104 | 126 112 1 48 70 72 48 I 160 136 182 158 22 1 126 94 70 22

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions