Effacer les filtres
Effacer les filtres

Blank plot in matlab

58 vues (au cours des 30 derniers jours)
MOUNIBA REDAH
MOUNIBA REDAH le 25 Juin 2019
Commenté : Star Strider le 27 Juin 2019
hello can you please help me?? when i type this code i only get a balnk plot
i don`t know where is my mistake
the code
sigma0=0;
el= 0.5;
L= 1 ;
h= 0.5 ;
a= 1;
N= 3;
g=10;
rho=1000;
Z0=0;
t=0:0.01:5;
x=0:0.02:el;
y=0:0.02:L;
[X,Y]=meshgrid (x,y);
sigma=0;
T=3*pi/4;
for n=0:N
for m=0:N
A=pi*((m/el)^(2)+(n/L)^(2))^(0.5);
B=(g*A+(sigma/rho)*A^3)*atan(A*h);
C=B^(0.5);
Z=a*cos(C.*T).*cos((m*pi/el).*X).*cos((n*pi/L).*Y);
Zs=Z0+Z;
Z0=Zs;
end
end
m=3;
n=4;
A=pi*((m/el)^(2)+(n/L)^(2))^(0.5);
B0=(g*A+(sigma0./rho)*A^3)*atan(A*h);
C0=(B0.^(0.5));
Z0=(a.*cos(C0.*T)).*cos((m*pi/el).*X).*(cos((n*pi/L).*Y));
figure
subplot(221)
plot(t,length(Z0));
xlabel(' temps s');
ylabel(' élévation z(x,y)y');
title(' sans tension superficielle');
legend('sigma0')

Réponse acceptée

Star Strider
Star Strider le 25 Juin 2019
The immediate problem is:
plot(t,length(Z0));
since the length function will produce a scalar, and you can only plot a scalar using a marker. (The plot function plots lines between two defined points, and a scalar has only one.)
Beyond that, however, ‘Z0’ is not a function of ‘t’, and has entiely different dimensions as the result, so you cannot plot it as a function of ‘t’.
This works:
plot(Z0);
however it is likely not the result you want. You need to fix that problem.
  22 commentaires
MOUNIBA REDAH
MOUNIBA REDAH le 27 Juin 2019
Modifié(e) : MOUNIBA REDAH le 27 Juin 2019
hello Star Strider a colegue had help me and give me some information the reason of Loops in my code is because there is a summuation in my equation
And gave me the code of It only It is not using Plot ,This example in using SURF because the result that gave me is in 3D
My qustion it is possible to modify in this code in order to plot the graph I Want I mean to change the eqaution above by this one : Capturesi.PNG
Ps The code attached
Star Strider
Star Strider le 27 Juin 2019
I have no clue as to what you want.
Try this:
t = linspace(0, 1); % Use Correct Time Limits
omega = rand(4); % Use Correct Values
for k1 = 1:4
for k2 = 1:4
Z(k1,k2,:) = acos(omega(k1,k2)*t);
end
end
Zs = sum(sum(Z,2),1);
Zs = squeeze(Zs);
figure
plot(t, Zs)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by