現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
How can I make matrix choose?
1 回表示 (過去 30 日間)
古いコメントを表示
I had a function get me variable m like that
- m=[60;90;90;180;125.3;90;60;45;135]
- and I need N to change when m changes.
- When m=0 or 180 N=0
- When m=90 N=1
- when m=45 or 135 N=0.5
- Otherwise P =5.
- N and P are matrices not just value because it will be used in other equations.
1 件のコメント
採用された回答
madhan ravi
2018 年 10 月 21 日
編集済み: madhan ravi
2018 年 10 月 21 日
>> m=[60;90;90;180;125.3;90;60;45;135]
N=zeros(1,numel(m)); % your N should be here instead of this
N(m==0 | m==180)=0;
N(m==90)=1;
N(m==45 | m==135)=0.5;
N = N'
m =
60.0000
90.0000
90.0000
180.0000
125.3000
90.0000
60.0000
45.0000
135.0000
N =
0
1.0000
1.0000
0
0
1.0000
0
0.5000
0.5000
>>
23 件のコメント
madhan ravi
2018 年 10 月 21 日
編集済み: madhan ravi
2018 年 10 月 21 日
What’s P?? Oh don’t need loop to do these operations
madhan ravi
2018 年 10 月 21 日
編集済み: madhan ravi
2018 年 10 月 21 日
The answer gives you all conditions for N
Mahmoud Sami
2018 年 10 月 21 日
I would like to thank you for your help, but unfortunately some wrong outputs all 45 degrees get N=0, not 0.5.
madhan ravi
2018 年 10 月 21 日
編集済み: madhan ravi
2018 年 10 月 21 日
you didn't provide the data for N so I gave zero values to N
madhan ravi
2018 年 10 月 21 日
編集済み: madhan ravi
2018 年 10 月 21 日
can you post the datas of N ? Like you gave
m=[60;90;90;180;125.3;90;60;45;135]
what are the values of N?
Mahmoud Sami
2018 年 10 月 21 日
My m in actual is 113*1. Here N is good in my code didn't get the answer.
madhan ravi
2018 年 10 月 21 日
編集済み: madhan ravi
2018 年 10 月 21 日
will you provide the real data of m and N this is the third time I'm asking? otherwise I can't help you if you don't cooperate
madhan ravi
2018 年 10 月 21 日
編集済み: madhan ravi
2018 年 10 月 21 日
explain with an example what you want to do (a simple one)
Mahmoud Sami
2018 年 10 月 21 日
https://www.mathworks.com/matlabcentral/fileexchange/20025-dijkstra-s-minimum-cost-path-algorithm
madhan ravi
2018 年 10 月 21 日
phew.. I don't think I have enough time to debug your code by reading your mind
Mahmoud Sami
2018 年 10 月 21 日
That's all data I have, other data is a mechanical data need more explain.
Mahmoud Sami
2018 年 10 月 21 日
I'm just new with matlab, so the kind of ask and answer is not known for me. Sorry
madhan ravi
2018 年 10 月 21 日
its ok it happens you will improve sooner :) , explain with steps what you are trying to achieve lets debug together
Mahmoud Sami
2018 年 10 月 21 日
My master is to get optimization for cost in a piping design system. The cost of piping depends on piping weight. So the piping lenght,diameter and other components is the major items L, OD, N. So I need to know the shortest path, then optimize the diameter and calculate the cost. N is no of elbows in system the degree of elbows affects cost as it affect industry. So need to change the angle between segments to 90 or 45 and minimize no. Of elbows also. The penalty fcn for genetic algorithms is to put penalty to cost if ang is not 90 or 45. To make the optimization not choose it. That's in simple way.
その他の回答 (0 件)
参考
タグ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)