![]() |
|
#1
|
|||
|
|||
Sine and Cosine Calculations in C++?Im trying to generate sample values of x(t), y(t), and z(t) at a sample
rate of 0.01 for "0 less than or equal to" t and "less than or equal to 6" Basically trying to store the sampled values in their respective files, but kind of lost on where to start? x(t) = sin(2*pi*t) y(t) = 2*sin(16*pi*t/3) + cos (2*pi*t/3) z(t) = x(t)*z(t) *all i know is this CPP / C++ / C Code:
|
|||
|
#2
|
|||
|
|||
Re: Sine and Cosine Calculations in C++???You should look into using a "for loop".
CPP / C++ / C Code:
If you need help writing to a file, let us know. |
|
#3
|
|||
|
|||
Re: Sine and Cosine Calculations in C++???yes how do you write a data point to a file?
also say for x(t) = sin(2*pi*t) would it just be that put into the code? then cin>>x(t) ? |
|
#4
|
|||
|
|||
Re: Sine and Cosine Calculations in C++???i think its wrong tho,
this is what i got runs but doesn't show anything blank screen (*command center) how do i write those calculations and write the data points to the file? CPP / C++ / C Code:
|
|
#5
|
|||
|
|||
Re: Sine and Cosine Calculations in C++?also another attempt
this is what i have so far: doesn't run properly though. also im trying to store the sampled values in their respective files and use excel to plot the sampled x(t), y(t), and z(t)...how do i do that my code: CPP / C++ / C Code:
|
|
#6
|
|||
|
|||
Re: Sine and Cosine Calculations in C++?can anyone assist me with this program?
|
|
#7
|
|||
|
|||
Re: Sine and Cosine Calculations in C++?Quote:
Look in your text or other course materials or some tutorial on the web. Here's where I might start:http://www.cplusplus.com/doc/tutorial/ If you want to jump to file I/O, you can look at the bottom and see this link: http://www.cplusplus.com/doc/tutorial/files/ However, I would start from the beginning and work my way through the entire thing. There are many examples and many principles that you might not discover trying to pick things up on your own. CPP / C++ / C Code:
Regards, Dave |
|
#8
|
|||
|
|||
Re: Sine and Cosine Calculations in C++?thank you! and also what does it mean excel plots?
just want to state the problem again: Write a C++ program to generate the sampled values of x(t), y(t), and z(t) at the sample rate of 0.01 for 0 less than or equal to t less than or equal to 600. Store the sampled values in their respective files and use Excel program to plot the sampled x(t), y(t), and z(t). x(t) = sin (2*pi*t) y(t) = 2*sin (16*pi*t/3) + cos (2*pi*t/3) z(t) = x(t) * y(t) Do not use for loop: for (t=0; t less than 600; t=t+0.01) instead use for loop: for (i=0; t less than 600; i++) { } *Send this character to file '/t' x[i] << '/t' << y[i] << '/t' << z[i] << endl; |
|
#9
|
|||
|
|||
Re: Sine and Cosine Calculations in C++?Quote:
(I have found that Excel will import a .csv file without being wizzed on.) When you do that the data will be spread across cells of a row. You can then select that row as data to be plotted in a chart. As for the rest of the drool... it won't help to smoke another bowl... |
Recent GIDBlog
Toyota - 2009 May Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sine versus pythagoras | juned | C++ Forum | 1 | 14-Dec-2008 09:17 |
| Angle between vectors | mosquito | C++ Forum | 14 | 21-Mar-2008 15:13 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The