I need to plot a 100 points for a math function, which is:
mu= 0.14-0.04*x;
I wish to use a 0.01 interval.
I believe that first I must store the values in an array, using a for loop. However, I can't seem to be able to evaluate the function, because whenever I type "mu(1)" in the command window I get "0.14" rather than "0.1". Other times, I just get "0.14-0.04*x"
How can I do this?

 채택된 답변

Image Analyst
Image Analyst 2019년 6월 16일

0 개 추천

Try this:
% Specify the start of the interval.
x1 = 1;
% The end of the interval is 0.01 after the start of the interval.
x2 = x1 + 0.01
% Make 100 points between x1 and x2
x = linspace(x1, x2, 100);
% Make the function
mu = 0.14 - 0.04 * x;
% Plot it
plot(x, mu, 'b-');
grid on;
xlabel('x', 'FontSize', 20);
ylabel('mu', 'FontSize', 20);

추가 답변 (0개)

카테고리

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

질문:

2019년 6월 16일

답변:

2019년 6월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by