b1 =1
b2 =2
b3 =3
%--------Function:
G =@(k) -2*k.^2 + b1 + sqrt( (-4*k.^4 - b2*k.^2 + sqrt((-4*k.^4 - b3*k.^2).^2 + b4^2 ))/2)
%-------Grid:
k = [-2:0.01:2]
% y = bsxfun(f,x,p)
% %-------Plot
%
% figure
plot(k,G)
help code wont run

 채택된 답변

Star Strider
Star Strider 2022년 5월 5일

1 개 추천

Call ‘G’ with its argument —
b1 =1
b1 = 1
b2 =2
b2 = 2
b3 =3
b3 = 3
b4 = 4 % Replace Missing Value
b4 = 4
%--------Function:
G =@(k) -2*k.^2 + b1 + sqrt( (-4*k.^4 - b2*k.^2 + sqrt((-4*k.^4 - b3*k.^2).^2 + b4^2 ))/2)
G = function_handle with value:
@(k)-2*k.^2+b1+sqrt((-4*k.^4-b2*k.^2+sqrt((-4*k.^4-b3*k.^2).^2+b4^2))/2)
%-------Grid:
k = [-2:0.01:2]
k = 1×401
-2.0000 -1.9900 -1.9800 -1.9700 -1.9600 -1.9500 -1.9400 -1.9300 -1.9200 -1.9100 -1.9000 -1.8900 -1.8800 -1.8700 -1.8600 -1.8500 -1.8400 -1.8300 -1.8200 -1.8100 -1.8000 -1.7900 -1.7800 -1.7700 -1.7600 -1.7500 -1.7400 -1.7300 -1.7200 -1.7100
% y = bsxfun(f,x,p)
% %-------Plot
%
% figure
plot(k,G(k))
.

댓글 수: 2

Tlotlo Oepeng
Tlotlo Oepeng 2022년 5월 5일
편집: Tlotlo Oepeng 2022년 5월 5일
youre the best
Star Strider
Star Strider 2022년 5월 5일
Thank you!

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

추가 답변 (1개)

Benjamin Kraus
Benjamin Kraus 2022년 5월 5일

0 개 추천

An alternative approach: Use fplot.
b1 = 1;
b2 = 2;
b3 = 3;
b4 = 4;
G =@(k) -2*k.^2 + b1 + sqrt( (-4*k.^4 - b2*k.^2 + sqrt((-4*k.^4 - b3*k.^2).^2 + b4^2 ))/2);
fplot(G)
xlim([-2 2])

카테고리

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

태그

질문:

2022년 5월 5일

댓글:

2022년 5월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by