Implicit Equation solution inside a for loop

조회 수: 2 (최근 30일)
Anshuman S
Anshuman S 2018년 1월 22일
댓글: Anshuman S 2018년 1월 22일
I want to solve the two expressions which are inside the for loop for o and p; and add their differenced sum of each iteration.
if true
% code
end
if true
% code subtotal = 0;
for i= 0:1:50
(sind(b+i) + sind(b-o)) -( 1.180/0.04 + sqrt.((1.140/0.04 - 2*sind(b)).^2 - (cosd(b-o)- cosd(b+i)).^2));
cotd(p-3.3) - cotd(i-1.0) - (1.180/(1.540 - 0.300));
subtotal = subtotal + (o - p).^2;
end
end
  댓글 수: 2
KSSV
KSSV 2018년 1월 22일
where are b, o ? define all the variables...give us full code and tell us what is your error....
Anshuman S
Anshuman S 2018년 1월 22일
I don't whether I have written this code correctly or not.
if true
% codetotal = 0;
err = 0;
bvals = 0:1:40;
o = 0;
p =0;
for b = bvals
subtotal = 0;
for i= 0:1:50
(sind(b+i) + sind(b-o)) -( 1.180/0.04 + sqrt.((1.140/0.04 - 2*sind(b)).^2 - (cosd(b-o)- cosd(b+i)).^2));
cotd(p-3.3) - cotd(i-1.0) - (1.180/(1.540 - 0.300));
subtotal = subtotal + (o - p).^2;
end
err = sqrt(subtotal/50);
plot(bvals,err);
hold on
total = total + subtotal;
end
end

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by