Plot only returning one point, MATLAB 2016
Show older comments
My partner and I are coding for a project and are struggling to create a plot without one point. We are having a hard time finding the issue in our code where we are only asking matlab to do so. Any suggestions to the code and counters in it would be appreciated.
%% Define Constants
Ly = 0.8; %[m] Lz = 0.6; %[m] f = 340; %[Hz] Uh = 20; %[m/s]
DeltaY = 0.1; %[m] DeltaZ = 0.1; %[m] Qs=Uh*DeltaY*DeltaZ; %[m3/s]
m=Ly/DeltaY; n=Lz/DeltaZ;
PoC = 415; %[rayl] c = 340; %[m/s]
w = 2*pi*340; %[rad/s] klength = 2*pi; s = pi/2;
theta = 0;
%% Set Output locations with (x,y,z) notation
Xa = 0.1*Ly; Ya = 0; Za = 0;
Xb = Ly; Yb = 0; Zb = 0;
Xc = 10*Ly; Yc = 0; Zc = 0;
Xd = 0.1*Ly; Yd = DeltaY; Zd = 0;
Xe = 1*Ly; Ye = DeltaY; Ze = 0;
Xf = 10*Ly; Yf = DeltaY; Zf = 0;
%% Point Source Arrays
Column = DeltaY * [-3.5 -2.5 -1.5 -0.5 0.5 1.5 2.5 3.5]; Row = DeltaZ * [ 2.5; 1.5; 0.5; -0.5; -1.5; -2.5 ];
X0 = 0; MagA=((PoC*klength)/(2*pi))*Qs;
%% Pressure Matrix -- Evaluated at Point A APressure=0; t = 0:0.0001:0.04999; length(t); AValue=zeros(1,length(t)); for t = 0:0.0001:0.05; for z=-0.25:0.1:0.25 for y=-0.35:0.1:0.35 xdisp=(Xa-X0); ydisp=(Ya-y); zdisp=(Za-z); radA=sqrt((xdisp)^2+(ydisp)^2+(zdisp)^2); APressureInc=MagA/radA*cos((w*t)-(klength*radA)+theta+s); APressure=APressure+APressureInc; end end AValue=APressure; end
figure() subplot(3,2,1) plot(t,ATimePressure)
Answers (0)
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!