how to implement following function in matlab?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
채택된 답변
Walter Roberson
2019년 3월 31일
M = @(i) abs(v(i)) .* sum( abs(v(1:n)) .* abs(y(i,1:n)) .* cos(q(i,1:n) + d(1:n) - d(i)) );
If n is the same as length(v) and size(y,2) and length(d) then the code can be written more compactly.
댓글 수: 10
I need solution of below equation and please give the matlab code for it.
n=size of matrix y

Change v(1:n) to reshape(v(1:n),1,[])
This is what i am getting solution on commad window.
I request you to give the full code based on above function.
M =
@(i)abs(v(i)).*sum(abs(reshape(v(1:n),1,[])).*abs(y(i,1:n)).*cos(angle(y(i,1:n)+angle(y(1:n)-angle(y(i))))))
the following is the code i have tried in matlab.
j=sqrt(2);
y=[1+j*1 1+j*2
2+j*3 3+j*3];
V=[1+j*0
1+j*3];
i=1;
n=2;
M = @(i) abs(v(i)) .* sum( abs(reshape(v(1:n),1,[])) .* abs(y(i,1:n)) .* cos(angle(y(i,1:n) + angle(y(1:n) - angle(y(i))))))
please give me the exact code.
j=sqrt(2);
y=[1+j*1 1+j*2
2+j*3 3+j*3];
v=[1+j*0
1+j*3];
i=1;
n=2;
M = @(i) abs(v(i)) .* sum( abs(reshape(v(1:n),1,[])) .* abs(y(i,1:n)) .* cos(angle(y(i,1:n) + angle(y(1:n) - angle(y(i))))))
The only difference is that your formula was defined in terms of lower-case v, but you created a variable with upper-case V.
Note that what you posted gives a formula: it means "given a particular value for i, here is the calculation you need to make". The M that you get from my code is a formula : you have to invoke it with a particular value of i in order to get the answer. For example,
M(2)
The value that you pass in must not exceed the number of rows in y.
j=sqrt(2);
y=[5.882-j*23.528 -2.941+j*11.764 -2.941+j*11.764
-2.941+j*11.764 5.882-j*23.528 -2.941+j*11.764
-2.941+j*11.764 -2.941+j*11.764 5.882-j*23.528];
v=[1.04+j*0
1+j*0
1.04+j*0];
i=2;
n=3;
M = @(i) abs(v(i)) .* sum( abs(reshape(v(1:n),1,[])) .* abs(y(i,1:n)) .* cos(angle(y(i,1:n) + angle((reshape(v(1:n),1,[]))-angle(v(i))))));
M(2)
M2=(abs(v2)*abs(v1)*abs(ybus(2,1))*cos((angle(ybus(2,1)))+del1-del2))+(abs(v2)*abs(v2)*abs(ybus(2,2))*cos(angle(ybus(2,2))))+(abs(v2)*abs(v3)*abs(ybus(2,3))*cos((angle(ybus(2,3))+del3-del2)))
the above is the code
after expanding the formula of M2 i have written the expansion,but i have not got M2 and M(2) as same;
got the answer thank you so much for your great reply.
i request you to give the standard code of above for any no of variables.
give the code for below function when k (is not equal to) i .png)
.png)
noti = @(i) setdiff(1:n,i);
M = @(i) abs(v(i)) .* sum( abs(reshape(v(noti(i)),1,[])) .* abs(y(i,noti(i))) .* cos(angle(y(i,noti(i)) + angle(y(noti(i)) - angle(y(i))))))
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
태그
아직 태그를 입력하지 않았습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)

