필터 지우기
필터 지우기

Don't know how to put set of numbers in equation

조회 수: 2 (최근 30일)
David
David 2023년 11월 3일
댓글: Les Beckham 2023년 11월 3일
Hello,
I'm new and I don't know how to put a set of numbers in one equation
fi = [0 3 13 23 33 34 43 53 63 73 83 90]
My equation:
N = a / (sqrt(1-e2 * sin(fi)^2))^3/2

채택된 답변

Les Beckham
Les Beckham 2023년 11월 3일
편집: Les Beckham 2023년 11월 3일
a = 1; % made up values - replace with the real ones
e2 = 0.1;
fi = [0 3 13 23 33 34 43 53 63 73 83 90];
N = a ./ (sqrt(1-e2 * sin(fi).^2)).^3/2;
% ^ ^ ^--- change these to element-wise operators
plot(fi, N)
grid on
xlabel 'fi'
ylabel 'N'
In case you meant 1e-2 instead of 1-e2:
N2 = a ./ (sqrt(1e-2 * sin(fi).^2)).^3/2;
figure
plot(fi, N2)
grid on
xlabel 'fi'
ylabel 'N2'
  댓글 수: 3
David
David 2023년 11월 3일
I will check out the tutorial, thank you so much for help
Les Beckham
Les Beckham 2023년 11월 3일
You are quite welcome. Please click the "Accept this answer" button on the answer that best helps with your question. You can also click the Vote button on any answer to show appreciation.

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

추가 답변 (2개)

Dyuman Joshi
Dyuman Joshi 2023년 11월 3일
As you have not specified the values of a and e2, I am assuming random scalar values for them.
Use array operations - Array vs Matrix Operations
fi = [0 3 13 23 33 34 43 53 63 73 83 90]
%Random value between 0 and 1
a = rand;
e2 = rand;
% vv vv vv
N = a./(sqrt(1-e2 * sin(fi).^2)).^3/2
If e2 is a vector, then use element-wise multiplication for e2 and sin() as well.
Also, I suggest you take the free MATLAB Onramp tutorial to learn the essentials of MATLAB.

Torsten
Torsten 2023년 11월 3일
Replace
N = a / (sqrt(1-e2 * sin(fi)^2))^3/2
by
N = a ./ (sqrt(1-e2 * sin(fi).^2)).^3/2
For an explanation, I suggest reading

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by