Evaluate this equation using increments of 0.1 starting from 0

조회 수: 8 (최근 30일)
Lk = 5;
ceq =1;
t=90;
q=0:0.1:0.5;
mq = (((4*sqrt(Lk*ceq))-t)/((2*q*t) - t));
I would like to evaulte mq using values from 0 to 0.5 in incremnts of 0.1. I want all the values stored for both q and mq.
Thanks

채택된 답변

Walter Roberson
Walter Roberson 2023년 7월 7일
Lk = 5;
ceq =1;
t=90;
q=0:0.1:0.5;
mq = (((4*sqrt(Lk*ceq))-t)./((2*q*t) - t));
plot(q, mq)

추가 답변 (1개)

Diwakar Diwakar
Diwakar Diwakar 2023년 7월 8일
To evaluate mq using values from 0 to 0.5 in increments of 0.1 and store the corresponding values for both q and mq, you can use a loop to iterate over the range of q values and calculate mq for each iteration
Lk = 5;
ceq = 1;
t = 90;
q = 0:0.1:0.5;
mq = ((4 * sqrt(Lk * ceq) - t) ./ ((2 * q * t) - t));
% Display the values
for i = 1:length(q)
disp(['q = ' num2str(q(i)) ', mq = ' num2str(mq(i))]);
end
q = 0, mq = 0.90062 q = 0.1, mq = 1.1258 q = 0.2, mq = 1.501 q = 0.3, mq = 2.2515 q = 0.4, mq = 4.5031 q = 0.5, mq = -Inf
  댓글 수: 1
Walter Roberson
Walter Roberson 2023년 7월 8일
instead of the display loop consider using compose() to do the formatting

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

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by