Solving MATLAB Problem: Sines, Cosines & Tangent Arrays

  • Thread starter Thread starter Erkan Tur
  • Start date Start date
  • Tags Tags
    Matlab
Click For Summary
The discussion focuses on a MATLAB problem involving the evaluation and storage of sine, cosine, and tangent values from 0 to 260 degrees in separate arrays. The user has written code to generate sine and cosine values but is struggling to define a new tangent array. Clarification is needed on whether to calculate tangent as the ratio of sine to cosine or if array multiplication can be used. It is emphasized that the sine and cosine arrays should contain the computed values rather than the angles themselves. The user seeks guidance on these issues to successfully complete the task.
Erkan Tur
Messages
5
Reaction score
1
Moved from a technical forum, so homework template missing.
Hello everyone, I've stuck on a problem, and I need help

Problem:
1: a) Evaluate and store the sine and cosine values of the values from 0 to 260 10 by 10 and store them to the separated arrays called sines and cosines before plotting the sinusoidal graphs of these arrays, b) Evaluate the Tangent of these values by simply using these arrays c) Use the built-in sin and cos functions to evaluate same results and compare the results with yours, explain the reason of the differences

My Steps on Solving the Problem
I've wrote the code, like this:

clear

sines = [0:10:260]
sin(sines)
subplot(1, 2, 1)
stem(sines,sind(sines)), grid on

hold on

cosines = [0:10:260]
cos(cosines)
subplot(1, 2, 2)
stem(cosines, cosd(cosines)), grid on

Problems I've encountered:
I was not able to define sine and cosine function, I've used the built-in functions for sine and cosine functions,
And I need help on defining new tangent array. I need to know, should I define the values for tangent as sin(n)/cos(n), or can I directly multiply arrays in order to get that done?

Thank you in advance
 
Physics news on Phys.org
Your arrays sines and cosines should contain the sin and cos, not the angles.

My guess is that in the first part, you need to input the values of sin and cos by hand.

The tangent should be obtained from the sines and cosines arrays.
 

Similar threads

  • · Replies 0 ·
Replies
0
Views
992
  • · Replies 0 ·
Replies
0
Views
1K
  • · Replies 0 ·
Replies
0
Views
579
  • · Replies 0 ·
Replies
0
Views
612
Replies
2
Views
1K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
4
Views
2K
  • · Replies 21 ·
Replies
21
Views
3K
  • · Replies 23 ·
Replies
23
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K