answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
xxTIMURxx
20 days ago
5

The geographic coordinate system is used to represent any location on Earth as a combination of latitude and longitude values. T

hese values are angles that can be written in the decimal degrees (DD) form or the degree, minutes, seconds (DMS) form just like time. For example, 24.5° is equivalent to 24°30'00''. Write a MATLAB script that will prompt the user for an angle in DD form and will print in sentence format the same angle in DMS form. The script should error-check for invalid user input. The angle conversion is to be done by calling a separate function in the script.
Computers and Technology
1 answer:
maria [1K]20 days ago
8 0

Answer:

Here is the script:  

function dd = functionDMS(dd)  

prompt= 'Enter angle in DD form ';

dd = input(prompt)

while (~checknum(dd))

if ~checknum(dd)

error('Enter valid input ');

end

dd = input(prompt)

end  

degrees = int(dd)

minutes = int(dd - degrees)

seconds = ( dd - degrees - minutes / 60 ) * 3600  

print degrees

print minutes

print seconds

print dd

Explanation:

This script requests the user to provide an angle in decimal degree (DD) format. It then stores that input in dd. The while loop checks if the input is valid. If it's not valid, an error message reads: Enter valid input. For valid inputs, the program converts dd into degrees, minutes, and seconds format. To compute degrees, only the integer part of dd is utilized. For minutes, the degree value is subtracted from dd. After that, the remaining decimal is multiplied by 60, using the integer part as minutes. For seconds, the difference between dd, degrees, and minutes is divided by 60, multiplied by 3600 to give the final value. In MATLAB, there's also a function that can convert decimal degrees to degrees minutes and seconds representation named degrees2dms.Another approach to converting dd to dms is:

data = "Enter value of dd"

dd = input(data)

degrees = fix(dd);

minutes = dd - degrees;

seconds = (dd-degrees-minutes/60) *3600;

You might be interested in
Write an expression to print each price in stock_prices. Sample output with inputs: 34.62 76.30 85.05
8_murik_8 [964]

Answer:

Below is the Python code:

stock_prices = input().split() #this takes input and separates it into a list

for price in stock_prices: #this loops through each stock price

   print("$",price) #this outputs each stock price prefixed by a dollar sign

Explanation:

The logic behind the program is clearly outlined in the attached comments. To illustrate the program's workings, let's consider an example:

Imagine the user inputs the stock_prices values of

34.62 76.30 85.05

The input() method captures user input, while the split() method divides the input string, providing a list of strings as:

['34.62', '76.30', '85.05']

Following that, the loop statement for price in stock_prices: iterates through each item in the list, and print("$",price) displays each value from the list on the output screen with a dollar sign, as follows:

$ 34.62                                                                                                            

$ 76.30                                                                                                            

$ 85.05    

4 0
2 months ago
In Section 8.5.4, we described a situation in which we prevent deadlock by ensuring that all locks are acquired in a certain ord
8_murik_8 [964]

Answer:

Refer to Explanation

Explanation:

Dividing this critical section into two parts:

void transaction(Account from, Account to, double amount)

{

Semaphore lock1, lock2;

lock1 = getLock(from);

lock2 = getLock(to);

wait(lock1);

withdraw(from, amount);

signal(lock1);

wait(lock2);

deposit(to, amount);

signal(lock2);

}

This approach is optimal in practice, as separating the critical section avoids any unintended states (for instance, resulting in withdrawing more funds than available).

The straightforward solution of keeping the critical section intact lies in ensuring that locks are acquired in the same order across all transactions. In this scenario, the locks can be sorted, choosing the smaller one to lock first.

4 0
1 month ago
A network administrator has received the IPv6 prefix 2001:DB8::/48 for subnetting. Assuming the administrator does not subnet in
8_murik_8 [964]

Answer:

subnets=65536

Explanation:

As per our knowledge,

--> the address's interface ID portion begins at 64

--> there exists a 48 bit network prefix

therefore,

the bits available for subnets are = 64-48=  16

thus, by utilizing 16 bits, the number of subnets can be calculated as = 2^16 = 65535

6 0
1 month ago
Coretta is thinking about which careers she would enjoy. She considers her personal skills and interests. She enjoys reading and
8_murik_8 [964]

Answer:

zoologist

Explanation:

5 0
2 months ago
Read 2 more answers
Which kind of image is indispensable and needs added text to how with it A. a map B. a chart C. a graph or D. a photograph
Amiraneli [1052]
My initial thought would be a photograph. A graph would be my second guess. I trust this reply resolves your inquiry!
4 0
1 month ago
Read 2 more answers
Other questions:
  • if you had two proxy servers located in the same room, what use could you make of them? nothing create a hub sell one of the ser
    14·2 answers
  • An employee of a large corporation remotely logs into the company using the appropriate username and password. The employee is a
    10·1 answer
  • Create a different version of the program that: Takes a 3-digit number and generates a 6-digit number with the 3-digit number re
    14·1 answer
  • Someone else can drive your car if _____.
    12·2 answers
  • A company requires an Ethernet connection from the north end of its office building to the south end. The distance between conne
    8·1 answer
  • CHALLENGE ACTIVITY 2.15.1: Reading and outputting strings. Write a program that reads a person's first and last names, separated
    10·1 answer
  • Which of the following is opened when the Find command is clicked?
    12·1 answer
  • Which of the following is NOT true about data?
    8·2 answers
  • A 2-dimensional 3x3 array of ints, has been created and assigned to tictactoe. Write an expression whose value is true if the el
    10·1 answer
  • What problem does the DNS solve? How does the DNS help the world wide web scale so that billions of users can access billions of
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!