Help graphing this equation

2 visualizzazioni (ultimi 30 giorni)
hans hans
hans hans il 18 Apr 2018
Risposto: njj1 il 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))

Risposta accettata

njj1
njj1 il 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!

Più risposte (0)

Categorie

Scopri di più su Graph and Network Algorithms in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by