Exam WS2021 22(2) UsersgoettingDocumentsVorlesungenComputer 1269515yfyjchbbhgkcvgfxdtrsecgghlluhitytfrxhzwrrhtfxhfjcgtfjydrjsesresxdghcjgvSciencesExamsWS20222 23Group 2Exam WS2021 22(2) docx Fachbereich Technik Department of Mechanical Engineering Prof Dr Rüdiger Götti.
Trang 1Fachbereich Technik
Department of Mechanical Engineering
Prof Dr Rüdiger Götting
Exam WS2022/23 (2) – Computer Sciences
Create a Simulink model of following ODE and run the simulation from a script and plot
Include answers to questions from below
ODE to solve:
𝐼 ∙ 𝑥̈(𝑡) + 𝑏 ∙ 𝑠𝑎𝑡,𝑥̇(𝑡) + 𝑎 ∙ 𝑥(𝑡) = 𝑔(𝑡)
𝑔(𝑡) = 𝑀!∙ sin (𝜔!𝑡)
𝑠𝑎𝑡,𝑥̇(𝑡) is a Saturation block (upper/lower limits = ±𝑠)
Additional informations:
• Simulation time: 𝑡𝑒𝑛𝑑 = 75𝑠𝑒𝑐
• Initialize all parameters of model in a script
• Solver: ode23, max step size: 0.1, relative accuracy: 10"#
• Log signal 𝑥(𝑡) to MATLAB workspace variable x (data type 𝐷𝑎𝑡𝑎𝑠𝑒𝑡)
• Run the simulation from a script and plot 𝑥(𝑡)
Parameters:
𝐼 = 2
𝑎 = 2
𝑏 = 2
𝑥! = 0.5 – initial value of x(t) = x(0)
𝑀! = 10
𝜔! = 25
𝑠 = 0.1
Trang 2Fachbereich Technik
Department of Mechanical Engineering
Prof Dr Rüdiger Götting
Questions MATLAB
Answer in MATLAB Script:
1) Code for loops to find the number 17 in matrix M Print results 𝑖, 𝑗, 𝑀(𝑖, 𝑗) in for-mat "M(i,j)=<element>” and finally set element to 0
Initialize matrix:
>> rng(87346538);
>> M= randi(20,10,10);
Use commands dispf() or compose()
2) Implement question 1) without for loop (Address element of M by column, row index as M([i,j])
3) Display a histogram of 1000 numbers from a Gaussian distribution Add labels and title to figure
Generate pseudorandom numbers with seed value:
>> rng(87346538);
4) Calculate the tangent of 30°, 45°, 60° using a symbolic variable
5) Define a function that returns the product of cos(x)*sin(y) x, y are arrays of same size
Test with identical arrays x, y:
>> x= [1:20]*pi/20
Enter your answers as comment or code in a MATLAB script!
Trang 3Fachbereich Technik
Department of Mechanical Engineering
Prof Dr Rüdiger Götting
Questions Python
Create a Jupyter Notebook:
1) Create a 4x4 random integer number matrix Sum the columns and the rows 2) Create a list of 10 numbers, sort the list and calculate the exponential values
𝑒$
3) Print values from a tuple 1,3,4,"five",6,7 using a list comprehension and format-ted output: "Number 1" etc
You have to submit a zip-archive of the project folder (delete folder slprj)