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
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;
Kuldeep Parmar
Kuldeep Parmar 2019년 5월 26일
Sorry for the poor explanation of the problem. Let me elabroste it:
Let us say in the pipe flow at a given point I am measuring fluid flow velocity and aceleration at every 1 sec interval. So now I have two dataset of velocity and accelaration at every 1 sec interval. Now I want to write a code which will give me in the given interval, let us say 10 sec will tell me how many times velocity and accelaration have assumed same values and plot the graph between velocity,accelaration and number of times they have assumed same values in the given interval.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by