// Numbas version: exam_results_page_options {"name": "Matlab Lab 4: Differentiation, Integration, Solving Differentiation equations", "metadata": {"description": "", "licence": "None specified"}, "duration": 0, "percentPass": "0", "showQuestionGroupNames": true, "showstudentname": true, "question_groups": [{"name": "Task A: Use diff to do the following differentiation. Please choose the correct matlab command(s) for each question. [3 marks]", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["", "", ""], "questions": [{"name": "Task A", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Alex Boote", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5098/"}], "tags": [], "metadata": {"description": "

For ENG1002 - Matlab Lab 4: Differentiation, Integration, Solving Differentiation equations.

", "licence": "All rights reserved"}, "statement": "

\n

Task A: Use diff to do the following differentiation. Please choose the correct matlab command(s) for each question. [3 marks]

\n

", "advice": "", "rulesets": {}, "variables": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "m_n_2", "useCustomName": true, "customName": "Question 1", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

$f = sin(2x) + x$, work out $\\frac{df}{dx}$ [1 mark]

", "minMarks": "0", "maxMarks": "1", "shuffleChoices": false, "displayType": "checkbox", "displayColumns": "1", "minAnswers": "1", "maxAnswers": "3", "warningType": "none", "showCellAnswerState": true, "choices": ["

A)    f=sin(2*x)+x; 
       diff(f)

", "

B)    syms x
       f=sin(2*x)+x; 
       diff(f)

\n

", "

C)    syms x
       diff(sin(2*x)+x)

"], "matrix": ["-1", "0.5", "0.5"], "distractors": ["A) Incorrect, the correct answers are B and C. You must use syms x to define the independent variable. ", "B) Correct, C is the other correct answer. You must use syms x to define the independent variable. ", "C) Correct, B is the other correct answer. You must use syms x to define the independent variable. "]}, {"type": "m_n_2", "useCustomName": true, "customName": "Question 2", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

2) $g = e^{3u} + ucos(u)$, work out $\\frac{dg}{du}$ [1 mark]

", "minMarks": 0, "maxMarks": "1", "shuffleChoices": false, "displayType": "checkbox", "displayColumns": "1", "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "choices": ["A)    syms x
       g=e(3*x)+x*cos(x);
       diff(g)", "

B)    syms x
       g=exp(3*x)+x*cos(x);
       diff(g)

"], "matrix": ["-1", "1"], "distractors": ["A) Incorrect, the correct answer is B. Use exp for exponential function. ", "B) Correct. Use exp for exponential function. "]}, {"type": "m_n_2", "useCustomName": true, "customName": "Question 3", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

3) $h = ln(t) + \\frac{5}{t}$, work out $\\frac{dh}{dt}$ [1 mark]

", "minMarks": 0, "maxMarks": "1", "shuffleChoices": false, "displayType": "checkbox", "displayColumns": "1", "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "choices": ["A)    syms x
       h=log(t)+5/t
       diff(h)", "B)    syms t
       h=ln(t)+5/t
       diff(h)", "

C)    syms t
       h=log(t)+5/t
       diff(h)

"], "matrix": ["-1", "-1", "1"], "distractors": ["A) Incorrect, the correct answer is C. You must use syms t because t is the independent variable in this case. Use log for ln in matlab. ", "B) Incorrect, the correct answer is C. You must use syms t because t is the independent variable in this case. Use log for ln in matlab. ", "C) Correct. You must use syms t because t is the independent variable in this case. Use log for ln in matlab. "]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Task B", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Alex Boote", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5098/"}], "tags": [], "metadata": {"description": "

For ENG1002 - Matlab Lab 4: Differentiation, Integration, Solving Differentiation equations.

", "licence": "All rights reserved"}, "statement": "

\n

Task B: Use dsolve to find the solution for the following equations. [3 marks]

\n

", "advice": "", "rulesets": {}, "variables": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "m_n_2", "useCustomName": true, "customName": "Question 1", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

$\\frac{dy}{dt} = 2y + 3$ [1 mark]

", "minMarks": 0, "maxMarks": "1", "shuffleChoices": false, "displayType": "checkbox", "displayColumns": "1", "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "choices": ["A)    syms t
       s=dsolve('Dy=2*y+3',t)", "B)    syms t
       s=dsolve('Dy=2*y+3')", "C)    s=dsolve('Dy=2*y+3')"], "matrix": ["0.34", "0.33", "0.33"], "distractors": ["A) Correct, all answers are correct. Matlab takes t as default independent variable in this case. See details in lecture notes.", "B) Correct, all answers are correct. Matlab takes t as default independent variable in this case. See details in lecture notes.", "C) Correct, all answers are correct. Matlab takes t as default independent variable in this case. See details in lecture notes."]}, {"type": "m_n_2", "useCustomName": true, "customName": "Question 2", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

$\\frac{dy}{dt} = y - \\frac{2t}{y}, y(0) = 1$ [1 mark]

", "minMarks": 0, "maxMarks": "1", "shuffleChoices": false, "displayType": "checkbox", "displayColumns": "1", "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "choices": ["

A)    s=dsolve('Dy=y-2*t/y','y(0)=1',t)

", "B)    s=dsolve('Dy=y-2*t/y','y(0)=1')"], "matrix": ["0.5", "0.5"], "distractors": ["A) Correct, both answers are correct. Matlab takes t as default independent variable in this case. ", "B) Correct, both answers are correct. Matlab takes t as default independent variable in this case. "]}, {"type": "m_n_2", "useCustomName": true, "customName": "Question 3", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

$\\frac{d^2y}{dx^2} = cos(x) - y, y(0) = 0, y^,(0) = 0$ [1 mark]

", "minMarks": 0, "maxMarks": "1", "shuffleChoices": false, "displayType": "checkbox", "displayColumns": "1", "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "choices": ["A)    s=dsolve('D2y=cos(x)-y','y(0)=0','Dy(0)=0')", "B)    syms x
       s=dsolve('D2y=cos(x)-y',y(0)=0,Dy(0)=0,x)", "C)    syms x
       s=dsolve('D2y=cos(x)-y','y(0)=0','Dy(0)=0',x)"], "matrix": ["-1", "-1", "1"], "distractors": ["A) Incorrect, the correct answer is C. In this case, independent variable is x. So, you must specify it using syms x. Please also do not forget the quotation marks for the initial conditions. ", "B) Incorrect, the correct answer is C. In this case, independent variable is x. So, you must specify it using syms x. Please also do not forget the quotation marks for the initial conditions. ", "C) Correct. In this case, independent variable is x. So, you must specify it using syms x. Please also do not forget the quotation marks for the initial conditions. "]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Task C", "extensions": [], "custom_part_types": [], "resources": [["question-resources/VICKY_MATLAB_PLOt.png", "/srv/numbas/media/question-resources/VICKY_MATLAB_PLOt.png"], ["question-resources/VICKY_MATLAB_PLOt_mdUZbm1.png", "/srv/numbas/media/question-resources/VICKY_MATLAB_PLOt_mdUZbm1.png"]], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Alex Boote", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5098/"}], "tags": [], "metadata": {"description": "

For ENG1002 - Matlab Lab 4: Differentiation, Integration, Solving Differentiation equations.

", "licence": "All rights reserved"}, "statement": "

Task C: Particle Motion Solve ODE's. [4 marks]

\n

The motion of three particles can be given by the following first-order ordinary differential equations (ODEs):

\n

$\\frac{dy_1}{dt}=(y_2-y_3)$

\n

$\\frac{dy_2}{dt}=(y_3-y_1)$

\n

$\\frac{dy_3}{dt}=(y_1-y_2)$

\n

where $y_1,y_2$ and $y_3$ are positions for particle 1, 2 and 3. 

\n

We could rewrite the equations above:

\n

$\\frac{d}{dt}\\left( \\begin{array}{ccc} y_1 \\\\ y_2 \\\\ y_3\\end{array} \\right) = \\left( \\begin{array}{ccc} y_2 - y_3 \\\\ y_3 - y_1 \\\\ y_1 - y_2\\end{array} \\right)$

\n

In MATLAB, if we solve these ODEs using the ode23 command and plot the results we should see a figure similar to the one below:

\n

", "advice": "", "rulesets": {}, "variables": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "m_n_2", "useCustomName": true, "customName": "Question 1", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Define the function $f$, which is a function of $t$ and $y$, to represent the differentiation equation above. [2 marks] 

", "minMarks": 0, "maxMarks": "2", "shuffleChoices": false, "displayType": "checkbox", "displayColumns": "1", "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "choices": ["A)    f = @(t,y) [y2-y3;y3-y1;y1-y2];", "B)    f = @(t,y) [y(2)-y(3);y(3)-y(1);y(1)-y(2)];"], "matrix": ["-2", "2"], "distractors": ["A) Incorrect, the correct answer is B. y1,y2, and y3 forms the matrix y. Then, in matlab, you should use y(1) for y1, y(2) for y2 and so on. ", "B) Correct. y1,y2, and y3 forms the matrix y. Then, in matlab, you should use y(1) for y1, y(2) for y2 and so on. "]}, {"type": "m_n_2", "useCustomName": true, "customName": "Question 2", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Use ode23 to plot the trajectory of all three particle in the first 6 seconds. When t=0s, the original positions for particle 1, 2 and 3 are 1, 0, -1 centimeter. [1.5 marks]

", "minMarks": 0, "maxMarks": "1.5", "shuffleChoices": false, "displayType": "checkbox", "displayColumns": "1", "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "choices": ["A)    ode23(f,0,6, [1;0;-1]);", "B)    ode23(f,[0,6], 1;0;-1);", "C)    ode23(f,[0,6], [1;0;-1]);"], "matrix": ["-1.5", "-1.5", "1.5"], "distractors": ["A) Incorrect, the correct answer is C. You must add square bracket for the limits of independent variable and the initial conditions. ", "B) Incorrect, the correct answer is C. You must add square bracket for the limits of independent variable and the initial conditions. ", "C) Correct. You must add square bracket for the limits of independent variable and the initial conditions. "]}, {"type": "m_n_2", "useCustomName": true, "customName": "Question 3", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Add title, legend, x and y axis labels to graph. [0.5 marks]

", "minMarks": 0, "maxMarks": "0.5", "shuffleChoices": false, "displayType": "checkbox", "displayColumns": "1", "minAnswers": 0, "maxAnswers": 0, "warningType": "none", "showCellAnswerState": true, "choices": ["

A)    title('Particle motion');
       xlabel('Time(s)');
       ylabel('Position');
       legend('Particle 1''Particle 2''Particle 3')

", "

B)    title('Particle motion');
       xlabel('Time(s)');
       ylabel('Position');
       legend('Particle 1','Particle 2','Particle 3')

"], "matrix": ["-0.5", "0.5"], "distractors": ["A) Incorrect, the correct answer is B. You must use comma (,) to separate legend for each curve. ", "Correct. You must use comma (,) to separate legend for each curve. "]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}]}], "navigation": {"allowregen": false, "reverse": true, "browse": true, "allowsteps": true, "showfrontpage": true, "showresultspage": "oncompletion", "navigatemode": "menu", "onleave": {"action": "warnifunattempted", "message": "

You have not answered one of the questions. 

"}, "preventleave": true, "startpassword": ""}, "timing": {"allowPause": true, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "feedback": {"showactualmark": true, "showtotalmark": true, "showanswerstate": true, "allowrevealanswer": true, "advicethreshold": 0, "intro": "

Select the answer(s) you think are correct and select submit answer. There may be some questions that have more than one correct answer. If you do not select all correct answers you will be given some of the marks. If you select a wrong answer you will be given 0 marks. If you select all correct answers you will recieve full marks for that question. Feedback will pop up regarding that specific question once your answer has been submitted. 

\n

Once you have submitted all answers on a page move onto the next task using the navigation screen. You can access the navigation screen by pressing the button at the top left of the screen. 

", "reviewshowscore": true, "reviewshowfeedback": true, "reviewshowexpectedanswer": true, "reviewshowadvice": true, "feedbackmessages": []}, "contributors": [{"name": "Alex Boote", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5098/"}], "extensions": [], "custom_part_types": [], "resources": [["question-resources/VICKY_MATLAB_PLOt.png", "/srv/numbas/media/question-resources/VICKY_MATLAB_PLOt.png"], ["question-resources/VICKY_MATLAB_PLOt_mdUZbm1.png", "/srv/numbas/media/question-resources/VICKY_MATLAB_PLOt_mdUZbm1.png"]]}