ok done that but i think my equations are working right
Good to hear it. Unless you meant to say you think they're not working right? You did read the documenation on the sin function, yes? So you know that it works in radians? The sin of 2*pi is zero, and so is sin 4*pi, and sin 6*pi, and on and on and on for every multiple of 2*pi. Given that all your sin calculations are for a multiple of 2*pi, your answers look pretty accurate.
The last thing that happens in each loop is t=t+2. Then the condition t<40 is checked, so if t does equal 40 at the start of a loop, that loop will not be run. If you want the loop to run when t=40, you need to change the condition to t<=40
ya i meant to say they are not working right because we were given an example of where t was going up in 5's so 2*pi*50*t was π/2(that should be the symbol for pi it doesnt copy over right) then for 10 it was π etc. so how do i get a similar answer?
These points are points for plotting a sin graph so the numbers i have won't work
Is the point of the assignment to show you the effect of aliasing - that is, the mistake that happens if you sample a signal at exactly the same frequency as the signal itself? Because that's the effect you're demonstrating.
is there a way to change the sin function then? i was just told that it takes a single argument, the angle in radians whose sin you require. like i said in the other reply we were given an example using this formula where t was going up in 5's and none of those answers where equal to 0 so why wont it work if i change t to t = t+2?
I suspect you've simply copied down the equation incorrectly. If the assignment is to use this exact equation: s(t) = (.22)sin(2*pi*50*t)
and t must be an integer, then the assignment is nonsense.
If the assignment is to produce points so you can use them to plot a sin curve, then you can stop messing around with that ridiculous equation and use something like:
s = sin(pi * t)
with t going from zero to 2 in steps of 0.1
Note also that in your original code this line dod nothing:
sin(angle)*0.22; //multiply angle by 0.22
Presumably you meant something like value = 0.22 * value;