Solving MATLAB Problem: Sines, Cosines & Tangent Arrays

  • Thread starter Thread starter Erkan Tur
  • Start date Start date
  • Tags Tags
    Matlab
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 1K views
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.