フィルターのクリア

New to matlab please help

1 回表示 (過去 30 日間)
Robert
Robert 2014 年 7 月 1 日
コメント済み: Robert 2014 年 7 月 1 日
Im brand new to matlab and can't figure this thing out Here is what I'm trying to do I simply want to create a basic plot of a capacitor charge current
Here is the code i wrote
close all
clear all
R = 50,000
C = 2200 * 10^-12
imax = 1/R
tau = R*C
t = [0:.0001:1]
current = imax*exp(-t ./ tau)
axis ([.00000001 .01 0 .01])
plot(t, current)
I can't see the plot no matter how i adjust the axis.The X axis always seems to stay 0 to 1 I don't understand why. Please rescue me. I spend more time fighting with this then i do actually doing my homework

採用された回答

Chad Greene
Chad Greene 2014 年 7 月 1 日
編集済み: Chad Greene 2014 年 7 月 1 日
A couple of things:
Make a habit of ending lines with a semicolon (;) to suppress the output. It doesn't make a big difference now, but later down the road with big data, printing the output will slow down processing.
Your R value is being read as 50 instead of 50000. If there are too many zeros for pleasant reading, you could type R = 50e+3.
Try semilogy instead of plot to show this data.
R = 50000;
C = 2200e-12;
imax = 1/R;
tau = R*C;
t = [0:.0001:1];
current = imax*exp(-t ./ tau);
axis ([.00000001 .01 0 .01]);
semilogy(t, current)
  8 件のコメント
Chad Greene
Chad Greene 2014 年 7 月 1 日
Glad to hear it.
On a side note, this is clunky: C = 2200 * 10^-12;.
Consider adopting this syntax instead: C = 2200e-12;
Robert
Robert 2014 年 7 月 1 日
will do. This is like my second day trying matlab so i appreciate the suggestions. Im still not 100% sure what i can and can't do. I have a C, C++ background and a few HDL,s and latex but don't know any matlab. Thanks again!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by