1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

A question on MATLAB

  1. Oct 2, 2016 #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
     
  2. jcsd
  3. Oct 2, 2016 #2

    DrClaude

    User Avatar

    Staff: Mentor

    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.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: A question on MATLAB
  1. MATLAB Question (Replies: 5)

  2. MATLAB question (Replies: 2)

  3. Matlab question (Replies: 2)

  4. Matlab question (Replies: 1)

Loading...