MATLAB Code Not Plotting Solution and Stuck on “Busy”
Hello,
I’m working on a MATLAB script to plot a solution, but the program gets stuck, continuously showing "Busy" in the status bar, and no plot is generated. I’ve checked my code for errors but haven’t found any obvious issues. What could be causing this behavior, and how can I resolve it?
Thank you for your help!
clear clc;
lambda1=0.4*1i;
lambda2 = 0; lambda3 =0; lambda4 = -1*1i; a =1; x =-0.001;
[A1, B2] = deal(1);
[A2, B1] = deal(0);
[A3, B4] = deal(1.2);
[A4, B3] = deal(1.5);
t = linspace(-10, 10, 800); % Adjust the range and number of points as needed
y = linspace(-10, 10, 800);
r1=zeros(length(x), length(y), length(t));
for k=1:length(x)
for l=1:length(t)
for m=1:length(y)
X1 = exp(-lambda1*a*y(m)*1i + t(l)*1i./(2*lambda1) + A1*(x(k) + y(m) + t(l)).^2);
X2 = exp(-lambda2*a*y(m)*1i + t(l)*1i./(2*lambda2) + A2*(x(k) + y(m) + t(l)).^2);
X3 = exp(-lambda3*a*y(m)*1i + t(l)*1i./(2*lambda3) + A3*(x(k) + y(m) + t(l)).^2);
X4 = exp(-lambda4*a*y(m)*1i + t(l)*1i./(2*lambda4) + A4*(x(k) + y(m) + t(l)).^2);
Y1 = exp(lambda1*a*y(m)*1i – t(l)*1i./(2*lambda1) + B1*(x(k) + y(m) + t(l)).^2);
Y2 = exp(lambda2*a*y(m)*1i – t(l)*1i./(2*lambda2) + B2*(x(k) + y(m) + t(l)).^2);
Y3 = exp(lambda3*a*y(m)*1i – t(l)*1i./(2*lambda3) + B3*(x(k) + y(m) + t(l)).^2);
Y4 = exp(lambda4*a*y(m)*1i – t(l)*1i./(2*lambda4) + B4*(x(k) + y(m) + t(l)).^2);
q2num = [X1 X2 X2 X4 0; Y1 Y2 Y3 Y4 0; X1./lambda1 X2./lambda2 X3./lambda3 X4./lambda4 1; Y1./lambda1 Y2./lambda2 Y3./lambda3 Y4./lambda4 0; X1./(lambda1.^2) X2./(lambda2.^2) X3./(lambda3.^2) X4./(lambda4.^2) 0];
den = [X1 X2 X2 X4; Y1 Y2 Y3 Y4; X1./lambda1 X2./lambda2 X3./lambda3 X4./lambda4; Y1./lambda1 Y2./lambda2 Y3./lambda3 Y4./lambda4];
r1(l,m,k)= ((det(q2num)./det(den)));
end
end
end
[dr1dx, dr1dy, dr1dt] = gradient(r1);
dr1dx = dr1dx/mean(diff(x));
dr1dy = dr1dy/mean(diff(y));
dr1dt = dr1dt/mean(diff(t));
p1=a + 1i*(dr1dy – dr1dx);
figure (1)
surf(y,t,abs(p1));
view(45,60);Hello,
I’m working on a MATLAB script to plot a solution, but the program gets stuck, continuously showing "Busy" in the status bar, and no plot is generated. I’ve checked my code for errors but haven’t found any obvious issues. What could be causing this behavior, and how can I resolve it?
Thank you for your help!
clear clc;
lambda1=0.4*1i;
lambda2 = 0; lambda3 =0; lambda4 = -1*1i; a =1; x =-0.001;
[A1, B2] = deal(1);
[A2, B1] = deal(0);
[A3, B4] = deal(1.2);
[A4, B3] = deal(1.5);
t = linspace(-10, 10, 800); % Adjust the range and number of points as needed
y = linspace(-10, 10, 800);
r1=zeros(length(x), length(y), length(t));
for k=1:length(x)
for l=1:length(t)
for m=1:length(y)
X1 = exp(-lambda1*a*y(m)*1i + t(l)*1i./(2*lambda1) + A1*(x(k) + y(m) + t(l)).^2);
X2 = exp(-lambda2*a*y(m)*1i + t(l)*1i./(2*lambda2) + A2*(x(k) + y(m) + t(l)).^2);
X3 = exp(-lambda3*a*y(m)*1i + t(l)*1i./(2*lambda3) + A3*(x(k) + y(m) + t(l)).^2);
X4 = exp(-lambda4*a*y(m)*1i + t(l)*1i./(2*lambda4) + A4*(x(k) + y(m) + t(l)).^2);
Y1 = exp(lambda1*a*y(m)*1i – t(l)*1i./(2*lambda1) + B1*(x(k) + y(m) + t(l)).^2);
Y2 = exp(lambda2*a*y(m)*1i – t(l)*1i./(2*lambda2) + B2*(x(k) + y(m) + t(l)).^2);
Y3 = exp(lambda3*a*y(m)*1i – t(l)*1i./(2*lambda3) + B3*(x(k) + y(m) + t(l)).^2);
Y4 = exp(lambda4*a*y(m)*1i – t(l)*1i./(2*lambda4) + B4*(x(k) + y(m) + t(l)).^2);
q2num = [X1 X2 X2 X4 0; Y1 Y2 Y3 Y4 0; X1./lambda1 X2./lambda2 X3./lambda3 X4./lambda4 1; Y1./lambda1 Y2./lambda2 Y3./lambda3 Y4./lambda4 0; X1./(lambda1.^2) X2./(lambda2.^2) X3./(lambda3.^2) X4./(lambda4.^2) 0];
den = [X1 X2 X2 X4; Y1 Y2 Y3 Y4; X1./lambda1 X2./lambda2 X3./lambda3 X4./lambda4; Y1./lambda1 Y2./lambda2 Y3./lambda3 Y4./lambda4];
r1(l,m,k)= ((det(q2num)./det(den)));
end
end
end
[dr1dx, dr1dy, dr1dt] = gradient(r1);
dr1dx = dr1dx/mean(diff(x));
dr1dy = dr1dy/mean(diff(y));
dr1dt = dr1dt/mean(diff(t));
p1=a + 1i*(dr1dy – dr1dx);
figure (1)
surf(y,t,abs(p1));
view(45,60); Hello,
I’m working on a MATLAB script to plot a solution, but the program gets stuck, continuously showing "Busy" in the status bar, and no plot is generated. I’ve checked my code for errors but haven’t found any obvious issues. What could be causing this behavior, and how can I resolve it?
Thank you for your help!
clear clc;
lambda1=0.4*1i;
lambda2 = 0; lambda3 =0; lambda4 = -1*1i; a =1; x =-0.001;
[A1, B2] = deal(1);
[A2, B1] = deal(0);
[A3, B4] = deal(1.2);
[A4, B3] = deal(1.5);
t = linspace(-10, 10, 800); % Adjust the range and number of points as needed
y = linspace(-10, 10, 800);
r1=zeros(length(x), length(y), length(t));
for k=1:length(x)
for l=1:length(t)
for m=1:length(y)
X1 = exp(-lambda1*a*y(m)*1i + t(l)*1i./(2*lambda1) + A1*(x(k) + y(m) + t(l)).^2);
X2 = exp(-lambda2*a*y(m)*1i + t(l)*1i./(2*lambda2) + A2*(x(k) + y(m) + t(l)).^2);
X3 = exp(-lambda3*a*y(m)*1i + t(l)*1i./(2*lambda3) + A3*(x(k) + y(m) + t(l)).^2);
X4 = exp(-lambda4*a*y(m)*1i + t(l)*1i./(2*lambda4) + A4*(x(k) + y(m) + t(l)).^2);
Y1 = exp(lambda1*a*y(m)*1i – t(l)*1i./(2*lambda1) + B1*(x(k) + y(m) + t(l)).^2);
Y2 = exp(lambda2*a*y(m)*1i – t(l)*1i./(2*lambda2) + B2*(x(k) + y(m) + t(l)).^2);
Y3 = exp(lambda3*a*y(m)*1i – t(l)*1i./(2*lambda3) + B3*(x(k) + y(m) + t(l)).^2);
Y4 = exp(lambda4*a*y(m)*1i – t(l)*1i./(2*lambda4) + B4*(x(k) + y(m) + t(l)).^2);
q2num = [X1 X2 X2 X4 0; Y1 Y2 Y3 Y4 0; X1./lambda1 X2./lambda2 X3./lambda3 X4./lambda4 1; Y1./lambda1 Y2./lambda2 Y3./lambda3 Y4./lambda4 0; X1./(lambda1.^2) X2./(lambda2.^2) X3./(lambda3.^2) X4./(lambda4.^2) 0];
den = [X1 X2 X2 X4; Y1 Y2 Y3 Y4; X1./lambda1 X2./lambda2 X3./lambda3 X4./lambda4; Y1./lambda1 Y2./lambda2 Y3./lambda3 Y4./lambda4];
r1(l,m,k)= ((det(q2num)./det(den)));
end
end
end
[dr1dx, dr1dy, dr1dt] = gradient(r1);
dr1dx = dr1dx/mean(diff(x));
dr1dy = dr1dy/mean(diff(y));
dr1dt = dr1dt/mean(diff(t));
p1=a + 1i*(dr1dy – dr1dx);
figure (1)
surf(y,t,abs(p1));
view(45,60); surface, 3d plots MATLAB Answers — New Questions