# Solving MATLAB Problem: Sines, Cosines & Tangent Arrays

• Erkan Tur
In summary, the conversation discusses a problem where the goal is to evaluate and store the sine and cosine values of numbers from 0 to 260 at increments of 10. The arrays sines and cosines are created and used to plot sinusoidal graphs. The built-in sin and cos functions are also used to compare the results. The issue encountered is not being able to define the sine and cosine functions and needing help with defining the tangent array. It is suggested to input the values of sin and cos by hand and to obtain the tangent from the sines and cosines arrays.
Erkan Tur
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?

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.

## 1. What is the purpose of solving MATLAB problems involving sines, cosines, and tangents?

The purpose of solving MATLAB problems involving sines, cosines, and tangents is to manipulate and analyze data using these fundamental trigonometric functions. These functions are commonly used in various fields of science, engineering, and mathematics to model and solve complex problems.

## 2. How do I create an array of sines, cosines, or tangents in MATLAB?

To create an array of sines, cosines, or tangents in MATLAB, you can use the built-in functions sind, cosd, and tand, respectively. These functions take in an array of angles (in degrees) and return an array of corresponding sines, cosines, or tangents.

## 3. Can I use MATLAB to plot sines, cosines, and tangents?

Yes, MATLAB has a built-in function plot that can be used to plot different types of data, including sines, cosines, and tangents. You can also customize the plot by adding labels, titles, and changing the color or style of the lines.

## 4. How can I use MATLAB to solve trigonometric equations?

You can use MATLAB to solve trigonometric equations by using the built-in function solve. This function takes in an equation or system of equations and solves for the unknown variables. You can also use the fzero function to find the roots of a single trigonometric equation.

## 5. Are there any tips for efficiently solving MATLAB problems involving sines, cosines, and tangents?

One tip for efficiently solving MATLAB problems involving sines, cosines, and tangents is to familiarize yourself with the different built-in functions and their syntax. You can also break down the problem into smaller, manageable steps and use comments to document your code. Additionally, using vectorization and pre-allocation can help improve the speed and efficiency of your code.

• Engineering and Comp Sci Homework Help
Replies
3
Views
2K
• Engineering and Comp Sci Homework Help
Replies
21
Views
2K
• Calculus and Beyond Homework Help
Replies
2
Views
2K
• Engineering and Comp Sci Homework Help
Replies
2
Views
1K
• Engineering and Comp Sci Homework Help
Replies
4
Views
1K
• Engineering and Comp Sci Homework Help
Replies
23
Views
2K
• Engineering and Comp Sci Homework Help
Replies
1
Views
2K
• General Math
Replies
4
Views
2K
• Introductory Physics Homework Help
Replies
6
Views
1K
• Engineering and Comp Sci Homework Help
Replies
1
Views
950