I have the an array of velocity and the Mass and I want to do a script which plot the energy only in deceleration.....Thank you.

 채택된 답변

sixwwwwww
sixwwwwww 2013년 10월 11일
편집: sixwwwwww 2013년 10월 11일
Dear Marco, here is code for kinetic energy in deceleration:
mass = 20;
velocity = 10:-0.1:1;
KE = 0.5 * mass * velocity .^ 2;
plot(velocity, KE),
title('Kinetic Energy vs Velocity'),
xlabel('Velocity')
ylabel('Kinetic Energy')
set(gca,'xdir','rev')
Good luck!

댓글 수: 5

Marco
Marco 2013년 10월 11일
but i have positive and negative array and i want to plot only the energy in deceleration
Marco
Marco 2013년 10월 11일
i want to calculate the energy in braking
In case of both negative and positive velocity values. You can start velocity vector from negative and increment in it a positive value. So code will be something like this:
mass = 20;
velocity = -10:0.1:1;
KE = 0.5 * mass * velocity .^ 2;
plot(velocity, KE),
title('Kinetic Energy vs Velocity'),
xlabel('Velocity')
ylabel('Kinetic Energy')
set(gca,'xdir','rev')
and if you don't need to plot velocity values on x-axis then you can modify above code lines as:
plot(KE),
set(gca,'ydir','rev')
I hope it help you
Marco
Marco 2013년 10월 11일
the velocity is always positive, I want to plot the energy when the acceleration is negative V = [10 20 10 5 15 40 20]; :-)
Here you have velocity values. When you see velocity decreasing then you can plot the KE for that region. You can do it using for loop and the code i posted above

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

추가 답변 (0개)

카테고리

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

태그

질문:

2013년 10월 11일

댓글:

2013년 10월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by