trying to plot the graph but getting dots pls help me

1 Ansicht (letzte 30 Tage)
SARVESH R
SARVESH R am 6 Jun. 2020
Bearbeitet: Ameer Hamza am 6 Jun. 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

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 6 Jun. 2020
Bearbeitet: Ameer Hamza am 6 Jun. 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*-')

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by