question archive This component is set as a coursework

This component is set as a coursework

Subject:MathPrice:9.82 Bought3

This component is set as a coursework. You must submit your answers by 23:59 Wednesday 23 March 2022. You will need to copy your code and output from the Matlab screen and paste it into a word document. You will need to use your enrolment number to complete the assessment in the following manner. Suppose your enrolment number is 25000234. 11 = 25000234 :1, 1:, ad are the last four numbers of your enrolment number. If any of the values are zero, change themtoa oneso here a = Lb = 2,: = 3,d = 4 Use Matlab to answer the following questions. No marks will be awarded to any questions answered by hand. You may be requested to explain and demonstrate your code. 1. Evaluate the following: i. 10" ii. (a + a)" iii. logn iv. Inn 0. :1: vi. :1: + 3: mt. n% 7 marks 2. Plot the points (a,b), (mo), (a,d), (b,c), (b,d),(c,d) joining each point to the next with a straight line. 6 marks 3. Plot the functions 3:1 = sin(a.x) ,y2 = coslfbx) and y; = sin(ax) + coslfbx) between the values 0" 5 x 5 360°. 12 marks 4. Use a FOR loop to differentiate y = a" cos(dx) in times in succession. 10 marks 5. Create a number Z = 1000:: + 1001: + 10c + d. Write a piece of code that will add together all the multiples of d between 0 and Z. 11 marks

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

Please find the solution in the attached images and codes.

Output for Q.1(i) is 10
Output for Q.1(ii) is 2187
Output for Q.1(iii) is 7.397944
Output for Q.1(iv) is 17.034396
Output for Q.1(v) is 54.598150
Output for Q.1(vi) is 0.020690
Output for Q.1(vii) is 5.492808
 

Answer for Question 4 is:
- 7*cos(4*x)*exp(3*x) - 24*sin(4*x)*exp(3*x)

Output for Q.5 is 190344

 

Step-by-step explanation


clc
clear all
close all

% Set last four digits as mentioned in the document
n = 25000234;
a = 1;
b = 2;
c = 3;
d = 4;

% Question 1
% Part i
out = 10^a;
fprintf("Output for Q.1(i) is %d\n",out);
% Part ii
out = (a+b)^(c+d);
fprintf("Output for Q.1(ii) is %d\n",out);
% Part iii
out = log10(n); % This is log base 10
fprintf("Output for Q.1(iii) is %f\n",out);
% Part iv
out = log(n); % This ln(n), i.e. log base e
fprintf("Output for Q.1(iv) is %f\n",out);
% Part v
out = exp(a+b)/exp(c-d);
fprintf("Output for Q.1(v) is %f\n",out);
% Part vi
out = (a^b + b^a)/(c^d + d^c);
fprintf("Output for Q.1(vi) is %f\n",out);
% Part vii
out = n^(a/10);
fprintf("Output for Q.1(vii) is %f\n",out);

% Question 2
x = [a a a b b c];  % x-coordinates of set points
y = [b c d c d d];  % y-coordinates of set points
plot(x,y)
xlim([0 5])
ylim([0 5])
title('Question 2 plot')

% Question 3
x = 0:0.1:360;  % degree array
y1 = sin(a*(x*pi/180)); % pi/180 is multiplied with x to converty it to radian
y2 = cos(b*(x*pi/180)); % pi/180 is multiplied with x to converty it to radian
y3 = sin(a*(x*pi/180)) + cos(b*(x*pi/180));
figure()
subplot(3,1,1)
plot(x,y1)
xlabel('x in degrees')
ylabel('y1')
subplot(3,1,2)
plot(x,y2)
xlabel('x in degrees')
ylabel('y2')
subplot(3,1,3)
plot(x,y3)
xlabel('x in degrees')
ylabel('y3')

% Question 4
syms x
y = exp(c*x)*cos(d*x);
y_dash = y;
for i = 1:b
    y_dash = diff(y_dash);
end
fprintf("Answer for Question 4 is:\n")
disp(y_dash)

% Question 5
Z = 1000*a + 100*b + 10*c + d;
out = sum(0:d:Z);
fprintf("Output for Q.5 is %d\n",out);

5 Question 2 plot 1.5 4 3.5 3
2.5 2 1.5 1 0.5 0 0 0.5 1 1.5 2
2.5 3 3.5 4 4.5 5 Please see attached file

question 3 plot


1 0.5 0 -0.5 - -1 50 100 150 200 250 300 350 400 x in degrees 1 0.5 - 0.5 -1 50 100 150 200 250 300 350 400 x in degrees 1 -1 -2 50 100 150 200 250 300 350 400 x in degrees

Please see attached file