Quiver Plot not plotting all data
Show older comments
Hi, I've created code to demonstrate a simple rankine vortex and initially I thought my code was wrong but I have since done the problem in excel, imported it to MATLAB and still the graph I am getting showing is omitting the majority of the data. I'm using a quiver plot and would expect arrows for every point on the grid.
I have pasted below the code to import the text file with the data inside (attached). I have also attached the plot I get and what I expect to get (roughly). I would really really appreciate any help. Thanks in advance
filename = 'C:\Users\TC\Documents\MATLAB\Free_Forced_Vorticity\ExcelOutput.txt';
delimiter = '\t';
formatSpec = '%f%f%f%f%f%f%f%f%[^\n\r]';
%%Open the text file.
fileID = fopen(filename,'r');
%%Read columns of data according to format string.
dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'ReturnOnError', false);
%%Close the text file.
fclose(fileID);
%%Allocate imported array to column variable names
i = dataArray{:, 1};
j = dataArray{:, 2};
x = dataArray{:, 3};
y = dataArray{:, 4};
r = dataArray{:, 5};
utheta = dataArray{:, 6};
u = dataArray{:, 7};
v = dataArray{:, 8};
%%Clear temporary variables
clearvars filename delimiter formatSpec fileID dataArray ans;
%%Graphing Data
quiver(x,y,u,v)
grid on
Accepted Answer
More Answers (0)
Categories
Find more on Vector Fields 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!