Lines Not Connecting In graph
古いコメントを表示
I have the following code but i am not able to get the graph to join the points together:a few of the files are attached.
for i = 1:62
T=(i-1)*30;
FTA=load(['XYpoints_timeFromDeparture_',num2str(T),'.txt']);
FTA = fopen(['XYpoints_timeFromDeparture_',num2str(T),'.txt']);
Xa=fscanf(FTA,'%f %*f %*f %*f',Inf);
fclose(FTA);
FTA = fopen(['XYpoints_timeFromDeparture_',num2str(T),'.txt']);
Ya=fscanf(FTA,'%*f %f %*f %*f',Inf);
fclose(FTA);
FTA = fopen(['XYpoints_timeFromDeparture_',num2str(T),'.txt']);
Xb=fscanf(FTA,'%*f %*f %f %*f',Inf);
fclose(FTA);
FTA = fopen(['XYpoints_timeFromDeparture_',num2str(T),'.txt']);
Yb=fscanf(FTA,'%*f %*f %*f %f',Inf);
fclose(FTA);
Op=([Xa]-[Xb]);
Ad=([Ya]-[Yb]);
Angle = atand(Op./Ad);
A = (i*30);
TTxt =sprintf('For Time At %.0f: ', A);
disp(TTxt)
AvgAngle = mean(Angle)*-1;
AvgAngleDISP = sprintf("The Average Angle is: %.3f°",AvgAngle);
disp(AvgAngleDISP)
V_MPH = ((tand(AvgAngle)*10*cosd(30)-10*sind(30))*2.237);
VT = sprintf("The Velocity is: %.3fmph",V_MPH);
disp(VT)
hold on
figure(3);
x = A/60;
y = V_MPH;
plot(x,y,'k-x')
xlabel('Time (Minutes)')
ylabel('Velocity (MPH)')
end
6 件のコメント
Ameer Hamza
2020 年 4 月 19 日
We cannot run your code because we don't have the txt files. Also, you haven't attached any image. How can we suggest anything useful?
SkyRider44
2020 年 4 月 19 日
Star Strider
2020 年 4 月 19 日
Please describe what you want to do with the data. (Your code is, at best, confusing.)
Ameer Hamza
2020 年 4 月 19 日
SkyRider44, the txt files you shared are not the ones required by this portion of your code.
Can you add a breakpoint at this line
plot(x,y,'k-x')
and paste the output of
size(x)
size(y)
SkyRider44
2020 年 4 月 19 日
SkyRider44
2020 年 4 月 19 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で 2-D and 3-D Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!