- that your variable velocitiesB1 and velocitiesB2 are not empty
- that those variables have at least 2 values
- that those values are not NaN
my plot is blank?
1 view (last 30 days)
Show older comments
my graph is generated but there are no lines that appear on the graph
clear;
close all;
clc;
%load the cross section distance along river
rivercrossection = load('Cross_Sections_DistanceAlongRiver_X_Y.txt', '\t');
% load the pre-dredging cross sections
pre_dredging_crossection = load("PreDredgingCS.txt");
pre_dredging_crossection = reshape(pre_dredging_crossection, [], 1);
%load post-dredging cross section
post_dredging_crossection = load("PostDredgingCS.txt");
post_dredging_crossection = reshape(post_dredging_crossection, [], 1);
% Calculate the volume of sediment using the detailed cross section
volume_crossection = sum(post_dredging_crossection - pre_dredging_crossection) * (rivercrossection(2) - rivercrossection(1)) * (pre_dredging_crossection(2) - pre_dredging_crossection(1));
% Calculate the velocities pre dredging
velocitiesB1 = (200 / (rivercrossection(2) - rivercrossection(1))) * (pre_dredging_crossection(2) - pre_dredging_crossection(1)) / (pre_dredging_crossection);
%calculate the velocities post dredging
velocitiesB2 = (200 / (rivercrossection(2) - rivercrossection(1))) * (post_dredging_crossection(2) - post_dredging_crossection(1)) / (post_dredging_crossection);
% Plot the current velocities for the cross section
figure(2);
plot(velocitiesB1,velocitiesB2,'b-');
xlabel("transect");
ylabel("Current velocity (m/s)");
title("Current velocities before and after dredging");
0 Comments
Answers (2)
Cris LaPierre
on 26 May 2023
There are 3 things to check right away
If you are plotting a single point, you won't be able to see it because your plot style does not include a marker style. Add one to see if this is the case.
plot(velocitiesB1,velocitiesB2,'b-*');
0 Comments
Image Analyst
on 26 May 2023
What does this show in the command window?
whos velocitiesB1
whos velocitiesB2
plot(velocitiesB1,velocitiesB2,'b-*');
0 Comments
See Also
Categories
Find more on Specifying Target for Graphics Output in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!