I want to write matlab code for the following problem : I have suppose two dataset for a given time period. Now I want to know for a given time interval how many times the dataset variables have equal values and I want to plot a surface between them
조회 수: 1 (최근 30일)
이전 댓글 표시
I have two Dataset of n×1 size for given time period. Now I want to create a function which will plot the surface graph between dataset01 and dataset02 and how many time both the dataset have common value between them. The function can ask me number of intervals and it should give me output a surface plot.
댓글 수: 6
Guillaume
2019년 5월 24일
It's still really not clear what it is you're trying to do. And the completely non-working code that you posted doesn't clarify.
It seems that your code tries to compare values of x and y at the same index. So why bother with intervals?
Problems with the code you've posted:
h=length(x)/n;
So, most likely h is not integer
for i=1:h:length(x)
So, i will be 1 at the first step, h+1 at the second step, 2*h+1 at the 3rd step, etc. Apart from the first step, it's very unlikely that i will be integer, yet:
count(i) = ...
you use i as an index. Non-integer indices are not valid. Note that since j starts at i, j will also be non-integer after the 1st step, so x(j) and y(j) are also non-valid.
Also, as stated, on the first step i will be 1, so
for j=i:1:h
will be fine, it's just
for j = 1:h
On the second step, i is h+1, so the j loop is then
for j = h+1:h
Since the start is greater than the end, the loop won't even start. It will be the same for every iteration. The j loop is only executed when i is 1.
Then we have
count(i) = 0+k;
0+k is of course just k and since k is always 1, The above is simply
count(i) = 1;
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!