How to attempt the first stage of this task?

1 visualización (últimos 30 días)
James Adams
James Adams el 23 de Feb. de 2020
Respondida: darova el 24 de Feb. de 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

Respuesta aceptada

darova
darova el 24 de Feb. de 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

Más respuestas (0)

Categorías

Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by