Ola
Ola

Reputation: 1

This matlab code does not display the graph

I need help for below matlab code to display the graph, using matlab 2015a.

clear all; close all;

syms k t

I_0=1; mu=1.5; lambda=0.3; gamma=0.1;

t=0:1:20;

y=I_0symsum((-lambda t.^(mu)).^k/(2.^((k(k-1)mu)/2)factorial(k mu)),k,[0, Inf]) + gammasymsum(((-lambda).^(k-1)(t.^(kmu)))/(2.^((k(k-1)*mu)/2)factorial(k mu)),k,[1 Inf]);

plot(t,y,'-+');

grid on

xlabel('time t');

ylabel('I(t)');

The graph is not displayed.

Upvotes: 0

Views: 45

Answers (1)

Ola
Ola

Reputation: 1

Editing the code as below produces the desired result.

TERMS = 30;

syms k t

I_0=1; mu=1.5; lambda=0.3; Gamma=0.1; 
t=0:1:20; 

inner1 = (-lambda *t.^(mu)).^k./(2.^((k*(k-1)*mu)/2).*gamma(k*mu+1));
inner2 = ((-lambda).^(k-1).*(t.^(k*mu)))./(2.^((k*(k-1)*mu)/2).*gamma(k*mu+1));

inner1sum = symsum(inner1, k, [0, TERMS]);
inner2sum = symsum(inner2, k, [1, TERMS]);  %notice different bounds

y = I_0 * inner1sum + Gamma * inner2sum;
Y = double(y);

plot(t, Y)
grid on
xlabel('time t');
ylabel('I(t)');

Upvotes: 0

Related Questions