Plotting issue where the curve is missing

1 view (last 30 days)
w=linspace(-5,-0.01)
w = 1×100
-5.0000 -4.9496 -4.8992 -4.8488 -4.7984 -4.7480 -4.6976 -4.6472 -4.5968 -4.5464 -4.4960 -4.4456 -4.3952 -4.3447 -4.2943 -4.2439 -4.1935 -4.1431 -4.0927 -4.0423 -3.9919 -3.9415 -3.8911 -3.8407 -3.7903 -3.7399 -3.6895 -3.6391 -3.5887 -3.5383
s=100;
for i=1:s
F = (exp(-1.863*10^-2)+w(i).^(-2)*exp(-1.9*10^-4)-2*w(i).^(-1)*exp(-9.41*10^-3));
O=4*pi*F
end
O = 17.8165
O = 17.8775
O = 17.9398
O = 18.0036
O = 18.0688
O = 18.1355
O = 18.2038
O = 18.2737
O = 18.3453
O = 18.4186
O = 18.4937
O = 18.5707
O = 18.6496
O = 18.7305
O = 18.8134
O = 18.8986
O = 18.9859
O = 19.0757
O = 19.1678
O = 19.2625
O = 19.3598
O = 19.4598
O = 19.5628
O = 19.6687
O = 19.7777
O = 19.8899
O = 20.0056
O = 20.1248
O = 20.2477
O = 20.3745
O = 20.5054
O = 20.6406
O = 20.7803
O = 20.9247
O = 21.0740
O = 21.2285
O = 21.3886
O = 21.5544
O = 21.7262
O = 21.9046
O = 22.0897
O = 22.2819
O = 22.4818
O = 22.6898
O = 22.9062
O = 23.1318
O = 23.3670
O = 23.6125
O = 23.8689
O = 24.1370
O = 24.4176
O = 24.7116
O = 25.0199
O = 25.3436
O = 25.6838
O = 26.0418
O = 26.4191
O = 26.8172
O = 27.2377
O = 27.6828
O = 28.1544
O = 28.6550
O = 29.1873
O = 29.7543
O = 30.3595
O = 31.0067
O = 31.7004
O = 32.4455
O = 33.2479
O = 34.1143
O = 35.0523
O = 36.0710
O = 37.1808
O = 38.3941
O = 39.7255
O = 41.1926
O = 42.8163
O = 44.6221
O = 46.6410
O = 48.9113
O = 51.4808
O = 54.4097
O = 57.7748
O = 61.6760
O = 66.2442
O = 71.6551
O = 78.1491
O = 86.0626
O = 95.8792
O = 108.3171
O = 124.4830
O = 146.1611
O = 176.3935
O = 220.7429
O = 290.3580
O = 410.5503
O = 650.2011
O = 1.2603e+03
O = 3.8680e+03
O = 1.2814e+05
plot(w,O)

Accepted Answer

KSSV
KSSV on 15 Jun 2022
Edited: KSSV on 15 Jun 2022
w=linspace(-5,-0.01) ;
s=100;
O = zeros(size(w)) ;
for i=1:s
F = (exp(-1.863*10^-2)+w(i).^(-2)*exp(-1.9*10^-4)-2*w(i).^(-1)*exp(-9.41*10^-3));
O(i)=4*pi*F ; %<-- save O into an array
end
plot(w,O)
Also note that, you need not to use loop.
w=linspace(-5,-0.01) ;
F = (exp(-1.863*10^-2)+w.^(-2)*exp(-1.9*10^-4)-2*w.^(-1)*exp(-9.41*10^-3));
O=4*pi*F ;
plot(w,O)

More Answers (0)

Categories

Find more on Line 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!