Re: [問題]Matlab找分段函數跟圓的交點與syms指令
※ 引述《leoking0106 (white)》之銘言:
: 找交點的部分我寫的code是這樣
: beta= 35;
: H=6;
: r=9.5;x0=2.5;y0=9.15;
: m=tan(beta*pi/180);
: xh=H/m;
: syms xx;
: y1=0;
: y2=m.*xx;
: y3=H;
: yup=(y1.*(heaviside(xx-(x0-r))-heaviside(xx))+...
: y2.*(heaviside(xx)-heaviside(xx-xh))+...
: y3.*(heaviside(xx-xh)-heaviside(xx-(x0+r))));
: ydown=-(r.^2-(xx-x0).^2).^0.5+y0;
: cc=solve(ydown-yup);
: plot(linspace(-1,12),subs(ydown,linspace(-1,12)),...
: linspace(-1,12),subs(yup,linspace(-1,12)))
: 我用plot確定我兩個函數是有交點的 但結果卻說沒有交點
: 能不能幫我看看是哪部分寫錯了呢?
: 還有我yup函數的最後一點yup(12)應該是6
: 但為什麼我用subs(yup,12)出來的值卻是3??
: 最後我想問用subs(y,x)可以找函數值
: 那有沒有甚麼指令是可以找反函數的呢?
: 拜託各位高手幫我看一下 debug好久好痛苦QQ
不好意思j大又來問你
你用我的code跑出來交點有值嗎?
我跑出來結果是
Warning: Explicit solution could not be found.
他還說錯誤出在solve那一行
我這樣寫的邏輯是對的嗎?
還是哪邊語法出錯誤呢??
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 223.136.205.184
→
05/12 15:01, , 1F
05/12 15:01, 1F
→
05/12 15:01, , 2F
05/12 15:01, 2F
→
05/12 15:17, , 3F
05/12 15:17, 3F
→
05/12 15:20, , 4F
05/12 15:20, 4F
→
05/12 16:18, , 5F
05/12 16:18, 5F
→
05/12 16:30, , 6F
05/12 16:30, 6F
→
05/12 20:31, , 7F
05/12 20:31, 7F
→
05/12 20:32, , 8F
05/12 20:32, 8F
→
05/12 20:33, , 9F
05/12 20:33, 9F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 5 之 5 篇):