How to plot a function with summation and multiple variables?

조회 수: 1 (최근 30일)
Anne Louise Barão
Anne Louise Barão 2021년 10월 24일
댓글: Anne Louise Barão 2021년 10월 24일
I would like to plot this function. I started writing the code but there are a lot of errors. Any help please!
n=10;
a = 1; %period
t = 0:0.1:1;%time
s=0.1;%area
t0=0.03;%impulse
ti=0.01;%random fluctuation around the average period
for i=1:n
eq(t)=a(i).*s.*(t-i.*t0-ti);
end
eq=sum(eq)

답변 (1개)

Ive J
Ive J 2021년 10월 24일
Start by understanding MATLAB a bit better. For the time being this may help you:
myfnc = @(A, s, t, i, T0, tau) sum(A.*s.*(t - i.*T0 - tau)); % based on the attached fig, both A and tau should be vectors
n = 10;
A = rand(1, n);
tau = rand(1, n);
s = 0.1;
t = linspace(0, 1, n); % doesn't seem to be a vector in your fig (?)
T0 = 0.03;
myfnc(A, s, t, 1:n, T0, tau)
ans = -0.0849
  댓글 수: 1
Anne Louise Barão
Anne Louise Barão 2021년 10월 24일
Hi! Thank you for your answer. A is a time-varying function. Tau is the smallest random fluctuation around the average period. I believe the random function for Tau is correct. t is the time it takes to create this signal so I made a vector. But I can't plot this function.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by