Clear Filters
Clear Filters

there is no plotting appearance

21 views (last 30 days)
Amro Ahmed
Amro Ahmed on 25 May 2024 at 11:37
Commented: VBBV on 25 May 2024 at 12:22
u=32620
u = 32620
l=1*10^-6
l = 1.0000e-06
a=u/l
a = 3.2620e+10
t=1*10^-6:100:1*10^-4
t = 1.0000e-06
b=a.*t
b = 32620
y=b*exp(-t/10^-6)
y = 1.2000e+04
plot(t,y)
  1 Comment
VBBV
VBBV on 25 May 2024 at 12:22

As @Stephen23 mentioned , use of linspace or logspace is more appropriate to plot graphs

t = linspace(1e-6,1e-4,100)
y = b.*exp(-t/10^-6) %use element wise multiplication also. 

Use also element wise multiplication operation.

Sign in to comment.

Answers (1)

Stephen23
Stephen23 on 25 May 2024 at 11:41
Edited: Stephen23 on 25 May 2024 at 11:44
"there is no plotting appearance"
Because you are plotting exactly one data point. By default there PLOT shows lines (which connect data points) and no data point markers. Because you have exactly one data point there is therefore no line and no marker.
If you want to make one data point visible then define a marker:
u = 32620;
l = 1*10^-6;
a = u/l;
t = 1*10^-6:100:1*10^-4
t = 1.0000e-06
b = a.*t;
y = b*exp(-t/10^-6)
y = 1.2000e+04
plot(t,y,'*')
  1 Comment
Stephen23
Stephen23 on 25 May 2024 at 12:13
Perhaps you incorrectly expect this line:
t = 1*10^-6:100:1*10^-4
t = 1.0000e-06
to produce a vector of values. You attempted to go from 1e-6 to 1e-4 in steps with size 100. How many steps of size 100 can you fit between 1e-6 and 1e-4 ? None, so only the first data point is returned.
You were probably attempting something like this:
t = linspace(1e-6,1e-4,100)
t = 1x100
1.0e-04 * 0.0100 0.0200 0.0300 0.0400 0.0500 0.0600 0.0700 0.0800 0.0900 0.1000 0.1100 0.1200 0.1300 0.1400 0.1500 0.1600 0.1700 0.1800 0.1900 0.2000 0.2100 0.2200 0.2300 0.2400 0.2500 0.2600 0.2700 0.2800 0.2900 0.3000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
or, given the range of values, perhaps this:
t = logspace(-6,-4,100)
t = 1x100
1.0e-04 * 0.0100 0.0105 0.0110 0.0115 0.0120 0.0126 0.0132 0.0138 0.0145 0.0152 0.0159 0.0167 0.0175 0.0183 0.0192 0.0201 0.0210 0.0221 0.0231 0.0242 0.0254 0.0266 0.0278 0.0292 0.0305 0.0320 0.0335 0.0351 0.0368 0.0385
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!