Help graphing this equation

2 ビュー (過去 30 日間)
hans hans
hans hans 2018 年 4 月 18 日
回答済み: njj1 2018 年 4 月 18 日
Hello, very new to MATLAB. I have managed to formulate the equation below, but have no idea how to graph it. Any help is much appreciated.
% let us assume values of variables
M=1;
N=2;
E=3;
t=1;
sigma=2;
n=2;
ans=M*sigma*(1/E+t/n)+N*sigma*(1-exp(-E*t/n))

採用された回答

njj1
njj1 2018 年 4 月 18 日

You need to have an independent variable (e.g., when plotting y vs. x, x is the independent variable). So if you want to plot epsilon against some other variable, that other variable needs to change. Here's some code that might do what you want.

M=1;
N=2;
E=3;
sigma=2;
n=2;
t = 0:0.01:10; %this means have the variable t start at 0 and move in increments of 0.01 until it reaches 10
epsilon = M*sigma.*(1/E + t/n) + N*sigma.*(1-exp(-E.*t/n)); %the meaning of ".*" is that we multiply against each element of the vector t
plot(t,epsilon)

Good luck!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by