MATLAB Answers

Help graphing this equation

1 view (last 30 days)
hans hans
hans hans on 18 Apr 2018
Answered: njj1 on 18 Apr 2018
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))

  0 Comments

Sign in to comment.

Accepted Answer

njj1
njj1 on 18 Apr 2018

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 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.