Hi I am trying to write a code that finds approximations of sine and cosine using the equations below with a given value of theta in degrees basically as a novice programmer i am having trouble setting upa a while loop for the expansions. Also can you guys please quote sources(books,web pages, etc.) for a beginner programmer in python for syntax and basic concepts. cos(x)= 1- x2/2! + x4/4! - x6/6! + .. sin(x)= x - x3/3! + x5/5! - x7/7! + .. Thanks in advance. |
+0 forum
3 | ||

Hello everyone, i am going to create a small tune though i have no idea how to go about it. I currently have a sine wave that plays for one second using a loop similar to this // loop to generate audio samples for(int n = 0; n < num_samples; n++) { int fr = 500; //Frequency data[n] = amp*sin(2*pi*fr*n/fs); cout << n << "\t" << data <<"\n"; } This generates a 500Hz tone. The next step is for me to play another tone, at a higher frequency straight after it. I am new to C++ and was wondering if … |
+0 forum
5 | ||

Hello everyone. I'm working on a project that acts as a function generator to output a sine wave. The program also outputs an excel file with all of the data points so one can plot the points. For some reason, when I add noise, the graph does not look right. Can anyone tell me why? I appreciate the help. Here is my code: #include "stdafx.h" #include <stdio.h> #include <tchar.h> #include <iostream> #include <math.h> #include <conio.h> #include <iomanip> #include <time.h> #include <stdlib.h> #include <dos.h> using namespace std; void lab_7 (void) { srand((unsigned)time(0)); // declarations FILE *fptr; char fileName[50] = ""; double … |
+0 forum
2 | ||

How to get the **Sine** and **Cosine** of an **inputed** number by the user? |
+0 forum
2 | ||

# I have Written a code for sine function but it is not much accurate# I have written a code for PI() and sin() function but it is not much accurate I want to make it more accurate can anybody tell how can I make it more accurate. Also I dont want to use constant value of pi. I want to find it out using function to the highest accuracy. Following is the code #include <iostream> #include <string> using namespace std; double factorial (int a); double power (double b, int power); double MySin(double c, int Accuracy = 100); double MyPi(double … |
+0 forum
2 | ||

Hi, I have a question about generating a 1kHz sine wave. First of all, we can't use the sin function so I just made a function that evaluates sin at some point... [CODE]int generate_sin(int t); { int sin; sin = t - ((t^3)/(3*2*1)) + ((t^5)/(5*4*3*2*1)); return sin; }[/CODE] Now, this function will evaulate sin at some number t but I am confused about the 1 kHz part... I'm probably just confused about the math behind it but how do I generate an entire 1kHz wave. Thanks |
+0 forum
3 | ||

I am currently working on this graph "thingy" were I am told to produce 4 types of graphs. [LIST] [*]y=x2 [*]y=x3 [*]y=x*sin(x) [*]y=x*cos(10*x) [/LIST] Now basically, I have the GUI/Interface ready. I seem to have a problem linking the [B]y=x*sin(x)[/B] button in the PlottingWindow class to the PlottingPanel where it is supposed to produce the line etc. In short once the sine button is pressed the graph is supposed to be produced. This is what I have till now. I would appreciate if someone could guide me. Thanks! Plotting Panel - [CODE]import javax.imageio.ImageIO; import javax.swing.*; import javax.swing.border.Border; import java.awt.*; import … |
+0 forum
4 | ||

Hi, I am developing some code to run on hardware and I am using the sin() and cos() functions inside the standard math.h many times, which slows the program down dramatically. I was wondering if there is a way to "approximate" the sine and cosine of a value (angle is between 0 and 2pi). Apparently there is a way to do it using look up tables but I don't really know how to create one? I would like to do it using just basic arithmetic operators, no math.h functions. Is there a simple way to compute the sine and cosine … |
+0 forum
5 | ||

Reusable Code Snippet
Create a synthetic 'sine wave' wave file You can use Python modules math, wave, and struct to create and save a synthetic sine wave of given frequency and duration (size) ... |
+1 forum
0 |

The End.