Hallo
how can i chnage the Sampling Interval to compare with other Plot ?
% v0=0;g=9.81;
t=[0:0.01:5]';s0=0;
[n,u]=size(t);
for i= 1:n
v(i)=v0+g*t(i);
s(i)=s0+v0*t(i)+0.5*g*t(i)^2;
end
figure()
plot(t,v,'+-')
title('Veolicity')
xlabel('Zeit')
ylabel('V,S')
hold on
plot(t,s,'r')
legend('V','S')

댓글 수: 5

The two plots have the same time interval as each other?
If you need to compare to a different plot that you have not shown us, then you would change the line
t=[0:0.03:5]';
Basem Nouh
Basem Nouh 2020년 4월 22일
thanks for answering but i meant as i understood the homework
i have time series t=[0:0.01:5]'
so i must Determine values (t,s,v) analytically and change the sampling interval for numerical integration. Compare the results.
Walter Roberson
Walter Roberson 2020년 4월 22일
The integrals work out to the code you already have.
What you were probably intended to do is to do incremental calculations, like
and similar for s, calculating each s from the one before. And then you were intended to compare those to the analytic equations, which are the equations you already have. The analytic equations only need to know the starting conditions and the current time, whereas for the non-analytic approach you need to know the value from the previous time step.
Basem Nouh
Basem Nouh 2020년 4월 22일
so does it mean i have to program the integral !
Walter Roberson
Walter Roberson 2020년 4월 22일
I do not know. It is your assignment, not mine. You did not show us the original question, so I do not know what they asked.
I can only advise based upon what I would expect the question to be about given the wording you used. Based upon what I expect it to be about, I would say that you have already implemented the integral. s(i)=s0+v0*t(i)+0.5*g*t(i)^2; is already a resolved integral. I would expect that what you need to do is implement the non-integral portion, the numeric simulation.

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

제품

릴리스

R2019b

질문:

2020년 4월 22일

댓글:

2020년 4월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by