[go: up one dir, main page]

0% found this document useful (0 votes)
266 views1 page

8th Semester Computational Physics Paper

This document is the exam paper for Computational Physics-II from the University of the Punjab. It contains 5 questions assessing MATLAB programming skills. The questions involve: accessing array elements, using MATLAB functions like diff, if/else, solve, ezplot; writing code to calculate the area of a sphere from random radii, print selected columns of a random matrix, plot a function, take a derivative, and evaluate an integral; writing programs to plot half and full waveforms of a sine function, calculate speeds and distances from a travel table, and calculate heights from drop times and solve a system of equations.

Uploaded by

Axe Malik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
266 views1 page

8th Semester Computational Physics Paper

This document is the exam paper for Computational Physics-II from the University of the Punjab. It contains 5 questions assessing MATLAB programming skills. The questions involve: accessing array elements, using MATLAB functions like diff, if/else, solve, ezplot; writing code to calculate the area of a sphere from random radii, print selected columns of a random matrix, plot a function, take a derivative, and evaluate an integral; writing programs to plot half and full waveforms of a sine function, calculate speeds and distances from a travel table, and calculate heights from drop times and solve a system of equations.

Uploaded by

Axe Malik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

UNIVERSITY OF THE PUNJAB

Eighth Semester 𝟐𝟎𝟏𝟗

Examination: B.S 𝟒 Year Programme Roll No..........................

PAPER: Computational Physics-II TIME ALLOWED:2 hrs & 30 mins.

C0urse Code: PHY-422 MAX. MARKS: 50


Attempt this paper on separate Answer sheet provided.

SUBJECTIVE

Q.2. Write short answers of the following Questions:


i. How to access an element in an array in MATLAB. 2
ii. Write the syntax with example of the followings in MATAB: 8
a) diff b) if else c) solve() d) ezplot()

Write MATLAB program code segment for the following: 10


iii.
a) To calculate area of sphere by using five random
radius values.
b) To print 1st 3rd and 5th columns in a 6x6 metrics
generated randomly.
c) To plot the graph between S and t. Function is
𝑆 = 2 sin(3𝑡 + 2) + √5𝑡 + 1 .
d) To find the derivative of the polynomial:
f(x) = 25x 3 − 44x 2 − 21x + 47
5
e) To evaluate∫0 𝑥𝑦 2 𝑑𝑦.
Q.3. Write a MATLAB program to show the waveform of half and 10
full wave according to the option pressed by the user.
𝑉𝑖𝑛 (𝑡) = sin(𝜋𝑡) , 0 ≤ 𝑡 ≤ 10
For Half wave:
𝑉 𝑉𝑖𝑛 ≥ 0
𝑉𝑜𝑢𝑡 = { 𝑖𝑛
0 𝑉𝑖𝑛 ≤ 0
For Full wave:
𝑉 𝑉𝑖𝑛 ≥ 0
𝑉𝑜𝑢𝑡 = { 𝑖𝑛
−𝑉𝑖𝑛 𝑉𝑖𝑛 ≤ 0

Q.4. Write a MATLAB program to find out corresponding speeds. Also 10


calculate max speed, average speed, total distance, longest route and
the route for which time is minimized.

Route 1 2 3 4 5
Distance 560 440 490 530 370
Time 10.3 8.2 9.1 10.1 7.5

Q.5 An object is dropped from different height reaching the ground 7+3
at time t, where 𝑡 = [5, 6, 7, 8, 9, 10.7]sec
Write MATLAB program to calculate height of the towers. Find
Average height, max and min height along with their
experiment number.
Write a MATLAB program to solve for x, y, z.
3𝑥 + 2𝑦 − 9𝑧 = −65
−9𝑥 − 5𝑦 + 2𝑧 = 16
6𝑥 + 7𝑦 + 3𝑧 = 5

You might also like