이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Difference between lines coding
조회 수: 1(최근 30일)
I am running the attached coding (run HW2W1) and I need to develop a code that will find the difference between points along the lines for the two lines for each graph. I am assuming the code will be the same for all three and I just have to adjust the file that I am referring.
For example, If i want to find out the difference between the two lines at 1.2 or finding out the difference between the two lines at -2.5.
thank you any help would be greatly appreciated it
Prudhvi Peddagoni 2020년 10월 22일
In the HW2W1.m file, you have (W1X,W1Y) and (W1xCI,WlyCL) variables(from HW2_P1_W1.txt). so you want to find the difference between the lines ploted by these two variable sets (x,y). but the problem is that the size of W1X and W1xCl is different.
You can use interp1 function interpolate the data for the 2nd plot. Then you can see the difference between the two plots
WlyCL_new=interp1(W1xCl,wlyCL, W1X)% this calculates the values of all y co-ordinates for W1X x-coordinates
%for finding the difference between the 2 plots at -1, you need to find -1 in W1X
%let it be idx
diff=W1Y(idx)-WlyCL(idx); % this gives the difference between two lines.
hope this helps.