Plot3 using 3 vectors of different length,

4 ビュー (過去 30 日間)
Waqar Ahmad
Waqar Ahmad 2020 年 1 月 20 日
コメント済み: Jakob B. Nielsen 2020 年 1 月 21 日
hello,
I am having two single row matrices with the values of Capacitance and Inductance respectively, and using these values I am making a third single row matrix of resonance frequencies. (for example if I have a two values of capacitance and two values of inductance then overall I would get 4 possible values of resonance frequency)
Now my aim is to plot a 3D plot using these three vectors however, I am getting the error "Vectors must be the same length"
because C and L vectors are [1*2] but F_resonance is [1*4] vector.
please guide.
  1 件のコメント
darova
darova 2020 年 1 月 20 日
Please attach the data and code

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

採用された回答

Jakob B. Nielsen
Jakob B. Nielsen 2020 年 1 月 21 日
編集済み: Jakob B. Nielsen 2020 年 1 月 21 日
The answer is in your error message. Plot3 plots a series of points (x,y,z) - the same would happen if you tried to plot(x,y) with x=[1 2 3] vs y=[1 2 3 4 5]. The dimensions just does not make sense.
What you are (probably) looking for is the surf or mesh functions. Have your F-resonance set up as a matrix instead of a vector, so that F_resonance(i,j) is a function of C(i) and L(j). In your example, you would turn F_resonance form a 1x4 vector into a 2x2 matrix. Then surf(C,L,F_resonance); will give you the surface plot.
  2 件のコメント
Waqar Ahmad
Waqar Ahmad 2020 年 1 月 21 日
Greetings and much thanks,
Yes dear Jakob B. Nielsen, I exactly wanted this thing. I thank you very much that you helped and solved my issue.
Thanks again.
Jakob B. Nielsen
Jakob B. Nielsen 2020 年 1 月 21 日
Hi Waqar,
Good to hear! Sometimes its all about finding the function you didnt know was there ;) If you can flag the answer as accepted, this thread will disappear from the unanswered questions section.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by