array in power place minus known variable
조회 수: 1 (최근 30일)
이전 댓글 표시
my equation is I = 12. 6^ (p - 9.5) +2 where p is an array [10: .25: 15]. not understanding why Im getting a syntax error. Is there another way to solve for I? Super new to MATLAB. Thank you.
댓글 수: 2
DGM
2021년 6월 28일
편집: DGM
2021년 6월 28일
What you posted:
I = 12. 6^ (p-9.50 +2 where p is an array [10: .25: 15)
Is obviously bad syntax with missing parentheses and mismatched brackets. I doubt this is what your actual code is.
Assuming this issue with the parentheses/brackets isn't actually your problem, paste the actual code as it's written. If you don't post the exact thing you're getting an error from, nobody can guess why.
답변 (1개)
Chunru
2021년 6월 28일
Use .^ for power of an array of numbers.
p = (10: .25: 15)
I = 12.6 .^ (p-9.50 +2);
plot(p,I)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!