trying to plot the graph but getting dots pls help me

2 vues (au cours des 30 derniers jours)
SARVESH R
SARVESH R le 6 Juin 2020
Modifié(e) : Ameer Hamza le 6 Juin 2020
for(n=1:0.25:2)
disp(['n =',num2str(n)])
for(s=0.5:0.5:10)
y=1+(n*(0.5513*log(((2*s)+(3*LL))/((2*s)+LL))))/(2*(0.5513*log(LL/B)+0.8235));
plot(s,y,'r*')
hold on
disp([num2str(s),' = ',num2str(y)])
end
end

Réponse acceptée

Ameer Hamza
Ameer Hamza le 6 Juin 2020
Modifié(e) : Ameer Hamza le 6 Juin 2020
Try this
B=1;
LL=1;
n=1:0.25:2;
s=0.5:0.5:10;
for i = 1:numel(n)
for j = 1:numel(s)
y(i,j)=1+(n(i)*(0.5513*log(((2*s(j))+(3*LL))/((2*s(j))+LL))))/(2*(0.5513*log(LL/B)+0.8235));
end
end
plot(s, y, 'r*-')
Following is an alternative version without for-loop
B=1;
LL=1;
n=1:0.25:2;
s=(0.5:0.5:10).';
y=1+(n.*(0.5513.*log(((2.*s)+(3.*LL))./((2.*s)+LL))))./(2*(0.5513*log(LL/B)+0.8235));
plot(s, y, 'r*-')

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by