MATLAB Programming Calculator
07 August 10:25
MATLAB, apartof additional things, can accomplish the functions of a simple calculator. Let us try to break a simple problem: Sams car s odometer account was 3215 if he endure abounding the ammunition tank. Bygone he arrested his odometer and it apprehend 3503. He abounding the catchbasin and noticed that it took 10 gallons to do that. If his car s gas catchbasin holds 15.4 gallons, how continued can he drive afore he is traveling to run out of gas, bold the gas breadth is the aforementioned as before?
First let us compute the ambit Sams car has travelled in amid the two gas fillings
>> 3503-3215
ans =
288
Gas breadth of Sams car is
>> 288/10
ans =
28.8
With this, he can drive
>> 28.8
ans =
443.5200
443.52 afar afore he runs out of gas.
Let us do the aforementioned example, now by creating called variables
>> ambit = 3503-3215
ambit =
288
>> breadth = distance/10
breadth =
28.8000
>> projected_distance = breadth
projected_distance =
443.5200
To anticipate the aftereffect from press out in the command window, use a semicolon afterwards the statement. The aftereffect will be stored in memory. You can then admission the capricious by calling its name. Example:
>>projected_distance = breadth >>
>>projected_distance
projected_distance =
443.5200
MATLAB, apartof additional things, can accomplish the functions of a simple calculator. Let us try to break a simple problem: Sams car s odometer account was 3215 if he endure abounding the ammunition tank. Bygone he arrested his odometer and it apprehend 3503. He abounding the catchbasin and noticed that it took 10 gallons to do that. If his car s gas catchbasin holds 15.4 gallons, how continued can he drive afore he is traveling to run out of gas, bold the gas breadth is the aforementioned as before?
First let us compute the ambit Sams car has travelled in amid the two gas fillings
>> 3503-3215
ans =
288
Gas breadth of Sams car is
>> 288/10
ans =
28.8
With this, he can drive
>> 28.8
ans =
443.5200
443.52 afar afore he runs out of gas.
Let us do the aforementioned example, now by creating called variables
>> ambit = 3503-3215
ambit =
288
>> breadth = distance/10
breadth =
28.8000
>> projected_distance = breadth
projected_distance =
443.5200
To anticipate the aftereffect from press out in the command window, use a semicolon afterwards the statement. The aftereffect will be stored in memory. You can then admission the capricious by calling its name. Example:
>>projected_distance = breadth >>
>>projected_distance
projected_distance =
443.5200
|
Tags: programming, calculator, distance, mileage distance, mileage, projected, calculator, matlab, , projected distance, mileage projected distance, distance mileage projected, projected distance mileage, programming calculator matlab, matlab programming calculator, |
Also see ...
PermalinkArticle In : Computers & Technology - Programming