フィルターのクリア

How to find unknown in the equation

2 ビュー (過去 30 日間)
Moza Mohamed
Moza Mohamed 2021 年 3 月 24 日
コメント済み: Star Strider 2021 年 3 月 24 日
How to find w in equation 2. Below is my code i dont know what seems to be the problem.
a=4.3*10.^-3
r=1.68*10.^-8
t=[0:100:1083]
p=r.*[1+a.*(t-20)]
c=0.385
figure
syms w
sol = solve(r.*(1+(a./c).*w)==p) % equation 2
vpa( sol )

採用された回答

Star Strider
Star Strider 2021 年 3 月 24 日
Since ‘p’ is a vector, probably the easiest way to do this is to use a loop:
for k = 1:numel(p)
sol(k) = vpasolve(r.*(1+(a./c).*w)==p(k)) % equation 2
end
Thagt gives 11 values for w’.
  2 件のコメント
Moza Mohamed
Moza Mohamed 2021 年 3 月 24 日
Thank you very much !!! I have another problem when trying to plot the values a figure is generated but without lines
for k = 1:numel(p)
sol = vpasolve(r.*(1+(a./c).*w)==p(k)) % equation 2
end
figure
plot(p,sol, "-b")
Star Strider
Star Strider 2021 年 3 月 24 日
Since ‘w’ is a funciton of ‘p’ and ‘sol’ is ‘w’, try this:
for k = 1:numel(p)
sol(k) = vpasolve(r.*(1+(a./c).*w)==p(k)); % equation 2
end
figure
plot(double(p), double(sol))
grid
xlabel('p')
ylabel('w')
The double calls are necessary in order to create the appropriate class of variables for plot.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by