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 CenterFile Exchange 中查找有关 Graph and Network Algorithms 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by