How do I plot for orthogonality?

Hello! I am having problem while plotting for an orthogonality problem. The function I need to integrate is: cos(2*pi*w*n*t) * cos (2*pi*w*n*t). Here w= 20, n=1,2,3,4,5,6, and m=2. Integration limit is from t=0 to t=T. According to orthogonality, the answer to the integral will be 1/2w. I have to use time period of 50 points.
syms t
m=2;
w=20;
for n= 1:1:5
y1=int( cos(2.*pi.*n.*w.*t).* cos(2.*pi.*m.*w.*t), t)
fplot (y1, [0 50])
hold on;
end
Is this the way to do it?

2 Comments

I don't understand what you are trying to plot and what you expect to see.
John D'Errico
John D'Errico on 6 Sep 2022
Edited: John D'Errico on 6 Sep 2022
Why would you possibly expect to get a sine function? The result of that integration would be a constant, not a function of t at all. Anyway, if you were expected to use a NUMERICAL integration, then int is the wrong tool to use! int is a SYMBOLIC integration.
Tools for numerical integration on a fixed set of points are things like trapezoidal rule, or Simpson's rule. While the function integral in MATLAB is also a variation of numerical integration, it does not operate on a fixed set of points, so it would NOT be acceptable for your assignment.

Sign in to comment.

Answers (0)

Asked:

on 6 Sep 2022

Edited:

on 6 Sep 2022

Community Treasure Hunt

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

Start Hunting!