Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Summing the values with looping
조회 수: 1 (최근 30일)
이전 댓글 표시
% i need to find the "Q" variable for every instance of "n" and divide those values by "Pr"
clear all
clc;
n=[1:1:50]
B=7.5 % angle value
%Q= (1+2*(cos(n1*B))^(5/2)+2*(cos(n2*B)^(5/2) + ... ); --> this is an
%example of how iterations should be in short; "1+2*(cos(n*B))^(5/2)"
Pr= 395
P1= Pr/Q
댓글 수: 1
답변 (1개)
Jonas
2022년 12월 7일
you could generate all values you asked for with a single expression. if you want the sum until a specific n, use cumsum() on the resulting vector
n=1:50;
B=7.5;
Q=[1 2*cos(n*B).^(5/2)]
size(Q)
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!