Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

According to special relativity, objects moving at speeds near the speed of light are shortened ( length contraction ) . Write a MATLAB program (

According to special relativity, objects moving at speeds near the speed of light are shortened (length contraction).
Write a MATLAB program (script) that given the length of a rod L in meters and the velocity of the rod v in meters per sem
be shortened by A rod of length L moving at velocity v is shortened by d, where d can be computed from
6L(1-
and c=300x10 m/s is the speed of light
The length of the rod and velocity of the rod should be read from the user using command line input Test your program to verify its operation include comments at the end of the program indicating the test cases used.
Hints: You can read in data from the user using MATLAB's built in function Input (on your own MATLAB Installation, it) and you can display results using MATLAB's built in function fprintf
MATLAB sertex) function will calculate the square root of x. For example, sqrt(4) will give you back 2 Using help under MATL
Make sure that
1. Program should have a proper comment header
2. Values should be stored in variables rather than using literats in the formula
3. Variables names should be meaningful
Solution 1:2 of 4 tests passed (50%)
Submitted about 18 hours ago | ID: 257533441| Size: 40
%1. get input - the length of a rod 1 in meters and the velocity of the rod v in meters per second
% Using input 10 for L and 280**10???6 for v to test your program.
%1= input('Please input the length of a rod');
%v= input('Please input the velocity of the rod');
% MATLAB input function read a number from a user if running under MATLAB, howevr, MATLAB grader does no support it at this time
% Assign the required values directly here and try other input values using input function under your MATLAB installation yourself
1=10;% meters
v=80**10???6;% meters per second
% initialize the speed of light
c=299792458; % meters per second
%2. do the magic - calculate the shorten amount - delta by prviding a correct fomula
d=1**1-(v???2c???2)2;
%3. display result
fprintf('The rod of length L=$0.2f moving at velocity v=80.2f is shontened by d=80.2f;,1,v,d;
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

Does it use a maximum of two typefaces or fonts?

Answered: 1 week ago