How to attempt the first stage of this task?

1 次查看(过去 30 天)
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

采纳的回答

darova
darova 2020-2-24
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by