Why do I get error when using a simple global variable?

I get error and it says ''Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters''
global a b t E nu
GP1=(-a/(sqrt(3),-b/(sqrt(3))
GP2=(a/(sqrt(3),-b/(sqrt(3))
GP3=(a/(sqrt(3),b/(sqrt(3))
GP4=(-a/(sqrt(3),b/(sqrt(3))

답변 (1개)

Chunru
Chunru 2022년 9월 27일
Not sure what the code is trying to do. However, the error is due to the wrong usage of ( ) rather than global variables.
global a b t E nu
a=1; b=2; t=3; nu=4;
GP1=[-a/sqrt(3),-b/sqrt(3)]
GP1 = 1×2
-0.5774 -1.1547
GP2=[a/sqrt(3),-b/sqrt(3)]
GP2 = 1×2
0.5774 -1.1547
GP3=[a/sqrt(3),b/sqrt(3)]
GP3 = 1×2
0.5774 1.1547
GP4=[-a/sqrt(3),b/sqrt(3)]
GP4 = 1×2
-0.5774 1.1547

카테고리

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

제품

릴리스

R2021a

질문:

2022년 9월 27일

답변:

2022년 9월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by