Make a MATLAB function which count on all the prime numbers from 0-1000.
• Sort the numbers in descending order.
• Sum all the even numbers in ascending order from 0-100.
• Use only While loop.
• Make a MATLAB function which count on all the prime numbers from 0-1000.
• Sort the numbers in descending order.
• Sum all the even numbers in ascending order from 0-100.
• Use only While loop.
Add pic matlab in text.
Write a MATLAB program to solve the following integral using
Simpson’s 1/3rd Rule.
I=∫ p0 (ax3+bx2+cx+d) dx=?
Assign suitable values of a, b, c and d.
Also assume suitable values of p and step size h.
Compare your program result with original one.
Apply Trapezoidal Rule, Simpsons 1/3 Rule and Trapezoidal Rule to compute
a
I=∫ p/q+x^2
0
Assume: i) the constant “a”- in between 1.1 to 1.5
ii) the constant “p” – in between 2 to 5.
iii) the constant “q” – in between 6 to 9.
iv) the increment “h” – in between 0.025 to 0.1
Generate data with the function y = ax^3 + bx^2 + cx + d in the range of x as it
varies from 0 to 2 with step increase of h . Assign suitable values of constants a, b, c and d.
Also assume the increment h to any value in between 0.1 to 0.25.
Write a MATLAB program to generate a sinusoidal signal consisting of frequencies 200Hz, 300Hz and 600Hz with sampling frequency of 2 kHz and pass it through a system H(z) which is cascade combination of two LTI systems H1(z) and H2(z) with zero initial condition and prove the output is same even if you change the order of H1(z) and H2(z) in the cascade connection.
For each of the following, write an algorithm and draw a flow chart then write a MATLAB code in separate script:
1. Finding the area of a rectangle and show it as below: The Area of This rectangle = ?
2. Finding sum of the even numbers from 2 to 100,
3. Finding the volume of a cylinder and show it as: The volume of This cylinder = ?
4. Finding the maximum number among three numbers entered by the user.
Examine the following loops and determine the number of times the loop executes and the final value of ires at the termination of the loop.
a) ires = 0;
for index = -12 : 12
ires = ires + 1;
end
b) ires = 0;
for index = 10 : -2 : 1
if index == 6 continue
end
ires = ires + index;
end
c) ires = 2;
while ires <= 100
ires = ires.^2;
end
d) ires = 2;
while ires > 100
ires = ires.^2;
end
Write MATLAB code to show the result card as shown below. Must ask user to enter the
following fields.
1. Student Name. 2. Reg # 3. Subjects
4. Obtained Marks
Automatically Grading are shown as
Obtained Marks>=80
A
Obtained Marks>=70
B
Obtained Marks>=60
c
Obtained Marks<60
D
compute Reimann sum of the function f(x)=e^(-x^2) for n=4 and n=10 by choosing ck at the right end of the point of the interval [0,2]