MATLAB Answers

How to attempt the first stage of this task?

2 views (last 30 days)
James Adams
James Adams on 23 Feb 2020
Answered: darova on 24 Feb 2020
Hey guys, I currently have been set a task to achieve, but I don't know where to begin. Below is the objectives i need to achieve.
  • a. Fill a 1024 point array (A) with two cycles of a cosine wave. Do the same for a second array (B). Form the product of the arrays and estimate it’s integral numerically. Plot A and B and the product and add the numerical value of the integral in the plot. You should not use the symbolic toolbox for this task.
  • b. Repeat 3.a, this time using 20 cycles of a cosine wave for array B. comment on the result.
  • c. Repeat 3.a again, this time using 2 cycles of a sine wave for array B. Comment on the results.
All approaches and suggestions are welcome.
Thanks to all,
James

Accepted Answer

darova
darova on 24 Feb 2020
I give you a start:
This is cosine wave (one cycle)
I usually use linspace to form array with number of points i want
x = linspace(0,4*pi,1024); % 1024 points for 2 cycles
Use cos() to create A and B arrays. Use trapz() to calculate integral numerically
Feel free to ask questions

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!