I want to know the value of x for each value of V

1 回表示 (過去 30 日間)
Pablo Zarco
Pablo Zarco 2021 年 2 月 10 日
コメント済み: Cris LaPierre 2021 年 2 月 10 日
V=[2,4,5,6,7]
for i=1:numel(V)
x(i)=(2+4*7+8-9*6+x(i))/(3+4*6*V(i)+3*x(i))
end
  2 件のコメント
the cyclist
the cyclist 2021 年 2 月 10 日
Can you please use more than one sentence to describe what you are trying to do? You have not given enough information for us to help you.
Pablo Zarco
Pablo Zarco 2021 年 2 月 10 日
Is an equation with one variable. The thing is that I would like to know if there is a way to solve this without clearing the x

サインインしてコメントする。

回答 (1 件)

Cris LaPierre
Cris LaPierre 2021 年 2 月 10 日
編集済み: Cris LaPierre 2021 年 2 月 10 日
You are using x to calculate x. This is causing an error since x doesn't exist yet.
What is the equation you are trying to implement in MATLAB?
  2 件のコメント
Pablo Zarco
Pablo Zarco 2021 年 2 月 10 日
That is the equation. Is an equation with only one variable. Is there any way to solve this without operating by clearing the x?
Cris LaPierre
Cris LaPierre 2021 年 2 月 10 日
V=[2,4,5,6,7];
fp=fplot(@(x)(2+4*7+8-9*6+x)./(3+4*6*V+3*x))
fp =
5×1 FunctionLine array: FunctionLine FunctionLine FunctionLine FunctionLine FunctionLine
legend("V="+num2str(V'))
Use the plot object to get the x and y data of each line. For example
x1 = fp(1).XData
x1 = 1×45
-5.0000 -4.7914 -4.5455 -4.3075 -4.0909 -3.8679 -3.6364 -3.3856 -3.1818 -2.9285 -2.7273 -2.5080 -2.2727 -2.0542 -1.8182 -1.5647 -1.3636 -1.1199 -0.9091 -0.6699 -0.4545 -0.2294 0 0.2273 0.4545 0.6909 0.9091 1.1546 1.3636 1.5870
y1 = fp(1).YData
y1 = 1×45
-0.5833 -0.5677 -0.5499 -0.5333 -0.5188 -0.5043 -0.4898 -0.4746 -0.4627 -0.4484 -0.4374 -0.4257 -0.4136 -0.4027 -0.3912 -0.3793 -0.3702 -0.3594 -0.3503 -0.3403 -0.3315 -0.3226 -0.3137 -0.3052 -0.2969 -0.2885 -0.2809 -0.2726 -0.2657 -0.2585

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by