- A more correct statement about the integral is that the integral of sin(x) is equal to C-cos(x), where C is a constant of integration. So, the most you can hope for is that your result is different from -cos(x) by a constant amount.
- Your program is comparing dy1 to y1. It should be comparing dy1 to y2. In that case, you will find that the graphs are the same, except for a constant displacement.
How to do integral for data
1 view (last 30 days)
How can I find y, if I know dy/dx from 0 to 1 ?
Since we know the integral of sinx is -cosx, I trie to use cumtrapz, but I cannot get correct line.
Here are my code. Can I have any hints for this? Thank you.
clear all;close all;clc
legend('sinx','interal : -cosx')
William on 7 Jan 2021
I have two comments: