現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
problem in iteration code
1 回表示 (過去 30 日間)
古いコメントを表示
please refer my last comment before start working on this code
i have to find the value of y(i) till y(i)-y(i-1)<=2.59e-4
can anyone help me with the code first correcting the error then how can i again start the iteration if y(i)-y(i-1)=>2.59e-4
necessary file is attached with question
1 件のコメント
回答 (1 件)
Walter Roberson
2017 年 2 月 9 日
By the point of vpaQ(3), your expression is so unstable that if you calculate the expression in floating point, then the difference in values between adjacent representable double precision numbers can on order of 10^33.
I will see if I can figure out what resolution would be required for reasonable operation.
8 件のコメント
NILESH PANDEY
2017 年 2 月 9 日
編集済み: NILESH PANDEY
2017 年 2 月 9 日
Thank you sir i want to inform you that Q should be in order of 1e34,35..etc because they are the inversion chargers in a semiconductor device and sir i wanna ask one more question using vpa is right ? by means i want to calculate Q and y,firstly Q(1) is given then i calculated y(1) then Q(2) is calculated then again y(2) and so on is this code is going in this way as i described above? if anything other information is required then kindly inform me
note:-sir above mathematics is developed by me so i am using a algorithm which i have developed,some other great scientist also calculated Q and y by other algo they used newton and gummel method for iteration i don't know how to use these i mentioned this because may be this can reduce complexity of calculation and algorithm which i am using is also correct
NILESH PANDEY
2017 年 2 月 9 日
編集済み: Walter Roberson
2017 年 2 月 9 日
hey i think i got solution of this problem because of limit of matlab display we can reduce the value of n in code what i observe if we keep n=5,6,7 then also the error produce by them as compare to if i keep n=102 is very low because of hyperbolic function they converge very fast so only n=5or7 terms is required for appropriate answer higher terms may be neglect by this all are coming in range
can anyone help me to plot different y(i) because in vpay(i) i got a vector of y(i) which has all y(i) i have to plot last y(i) so how should i get last y(i) and plot this ?
NILESH PANDEY
2017 年 2 月 10 日
編集済み: NILESH PANDEY
2017 年 2 月 10 日
hi i got the last value of vpa by using vpay(k) where k is whatever value of y i want,i still can't plot this suppose i got vpay(6) as
(3852594936737163*sin((5270717853328913*x)/8388608))/9223372036854775808 - (5720530583262469*sin((3294198658330571*x)/4194304))/2305843009213693952 - (1890191513553995*sin((3953038389996685*x)/8388608))/72057594037927936 - (1239487464334486929408*x)/8079879893910767 + (788820049541845*sin((5270717853328913*x)/16777216))/288230376151711744 - (160878178232529*sin((5270717853328913*x)/33554432))/281474976710656 - ((2927114230116077*sin((3294198658330571*x)/4194304))/1152921504606846976 + (8956713847111951*sin((3953038389996685*x)/8388608))/288230376151711744 + (6532666692102853*sin((5270717853328913*x)/33554432))/9007199254740992)*((1259161868530272436224*x)/283303674451637 + (5720530583262469*sin((3294198658330571*x)/4194304))/79586171463010656 + (1890191513553995*sin((3953038389996685*x)/8388608))/2487067858219083 - (1284198312245721*sin((5270717853328913*x)/8388608))/106114895284014208 - (788820049541845*sin((5270717853328913*x)/16777216))/9948271432876332 + (13728271209175808*sin((5270717853328913*x)/33554432))/829022619406361 + (((2927114230116077*sin((3294198658330571*x)/4194304))/16 + (8956713847111951*sin((3953038389996685*x)/8388608))/4 + 52261333536822824*sin((5270717853328913*x)/33554432))*((1259161868530272436224*x)/283303674451637 + (5720530583262469*sin((3294198658330571*x)/4194304))/79586171463010656 + (1890191513553995*sin((3953038389996685*x)/8388608))/2487067858219083 - (1284198312245721*sin((5270717853328913*x)/8388608))/106114895284014208 - (788820049541845*sin((5270717853328913*x)/16777216))/9948271432876332 + (13728271209175808*sin((5270717853328913*x)/33554432))/829022619406361 + (((2927114230116077*sin((3294198658330571*x)/4194304))/16 + (8956713847111951*sin((3953038389996685*x)/8388608))/4 + 52261333536822824*sin((5270717853328913*x)/33554432))*((1259161868530272436224*x)/283303674451637 + (5720530583262469*sin((3294198658330571*x)/4194304))/79586171463010656 + (1890191513553995*sin((3953038389996685*x)/8388608))/2487067858219083 - (1284198312245721*sin((5270717853328913*x)/8388608))/106114895284014208 - (788820049541845*sin((5270717853328913*x)/16777216))/9948271432876332 + (13728271209175808*sin((5270717853328913*x)/33554432))/829022619406361 + (((2927114230116077*sin((3294198658330571*x)/4194304))/16 + (8956713847111951*sin((3953038389996685*x)/8388608))/4 + 52261333536822824*sin((5270717853328913*x)/33554432))*((1259161868530272436224*x)/283303674451637 + (5720530583262469*sin((3294198658330571*x)/4194304))/79586171463010656 + (1890191513553995*sin((3953038389996685*x)/8388608))/2487067858219083 - (1284198312245721*sin((5270717853328913*x)/8388608))/106114895284014208 - (788820049541845*sin((5270717853328913*x)/16777216))/9948271432876332 + (13728271209175808*sin((5270717853328913*x)/33554432))/829022619406361 + (((2927114230116077*sin((3294198658330571*x)/4194304))/16 + (8956713847111951*sin((3953038389996685*x)/8388608))/4 + 52261333536822824*sin((5270717853328913*x)/33554432))*((1259161868530272436224*x)/283303674451637 + (5720530583262469*sin((3294198658330571*x)/4194304))/79586171463010656 + (1890191513553995*sin((3953038389996685*x)/8388608))/2487067858219083 - (1284198312245721*sin((5270717853328913*x)/8388608))/106114895284014208 - (788820049541845*sin((5270717853328913*x)/16777216))/9948271432876332 + (13728271209175808*sin((5270717853328913*x)/33554432))/829022619406361 + (((1343318374775049260107797263568950807725342720*x)/6676171946239829 - 25783765124455804)*((2927114230116077*sin((3294198658330571*x)/4194304))/1152921504606846976 + (8956713847111951*sin((3953038389996685*x)/8388608))/288230376151711744 + (6532666692102853*sin((5270717853328913*x)/33554432))/9007199254740992))/2487067858219083 - (440706653985595377864088223744*power(x,2))/1983125721161459 - 4842029219725213/8589934592))/2487067858219083 - (440706653985595377864088223744*power(x,2))/1983125721161459 - 2897132367089491/70368744177664))/2487067858219083 - (440706653985595377864088223744*power(x,2))/1983125721161459 - 5794264734608811/140737488355328))/2487067858219083 - (440706653985595377864088223744*power(x,2))/1983125721161459 - 5794264734608831/140737488355328))/2487067858219083 - (440706653985595377864088223744*power(x,2))/1983125721161459 - 5794264734608831/140737488355328) + (61974373216724350012137406464*power(x,2))/8079879893910767 + 789/1000
then i can't get the plot i am using
clear all
L=25e-9;
x=0:1e-10:L;
z=(3852594936737163*sin((5270717853328913*x)/8388608))/9223372036854775808 - (5720530583262469*sin((3294198658330571*x)/4194304))/2305843009213693952 - (1890191513553995*sin((3953038389996685*x)/8388608))/72057594037927936 - (1239487464334486929408*x)/8079879893910767 + (788820049541845*sin((5270717853328913*x)/16777216))/288230376151711744 - (160878178232529*sin((5270717853328913*x)/33554432))/281474976710656 - ((2927114230116077*sin((3294198658330571*x)/4194304))/1152921504606846976 + (8956713847111951*sin((3953038389996685*x)/8388608))/288230376151711744 + (6532666692102853*sin((5270717853328913*x)/33554432))/9007199254740992)*((1259161868530272436224*x)/283303674451637 + (5720530583262469*sin((3294198658330571*x)/4194304))/79586171463010656 + (1890191513553995*sin((3953038389996685*x)/8388608))/2487067858219083 - (1284198312245721*sin((5270717853328913*x)/8388608))/106114895284014208 - (788820049541845*sin((5270717853328913*x)/16777216))/9948271432876332 + (13728271209175808*sin((5270717853328913*x)/33554432))/829022619406361 + (((2927114230116077*sin((3294198658330571*x)/4194304))/16 + (8956713847111951*sin((3953038389996685*x)/8388608))/4 + 52261333536822824*sin((5270717853328913*x)/33554432))*((1259161868530272436224*x)/283303674451637 + (5720530583262469*sin((3294198658330571*x)/4194304))/79586171463010656 + (1890191513553995*sin((3953038389996685*x)/8388608))/2487067858219083 - (1284198312245721*sin((5270717853328913*x)/8388608))/106114895284014208 - (788820049541845*sin((5270717853328913*x)/16777216))/9948271432876332 + (13728271209175808*sin((5270717853328913*x)/33554432))/829022619406361 + (((2927114230116077*sin((3294198658330571*x)/4194304))/16 + (8956713847111951*sin((3953038389996685*x)/8388608))/4 + 52261333536822824*sin((5270717853328913*x)/33554432))*((1259161868530272436224*x)/283303674451637 + (5720530583262469*sin((3294198658330571*x)/4194304))/79586171463010656 + (1890191513553995*sin((3953038389996685*x)/8388608))/2487067858219083 - (1284198312245721*sin((5270717853328913*x)/8388608))/106114895284014208 - (788820049541845*sin((5270717853328913*x)/16777216))/9948271432876332 + (13728271209175808*sin((5270717853328913*x)/33554432))/829022619406361 + (((2927114230116077*sin((3294198658330571*x)/4194304))/16 + (8956713847111951*sin((3953038389996685*x)/8388608))/4 + 52261333536822824*sin((5270717853328913*x)/33554432))*((1259161868530272436224*x)/283303674451637 + (5720530583262469*sin((3294198658330571*x)/4194304))/79586171463010656 + (1890191513553995*sin((3953038389996685*x)/8388608))/2487067858219083 - (1284198312245721*sin((5270717853328913*x)/8388608))/106114895284014208 - (788820049541845*sin((5270717853328913*x)/16777216))/9948271432876332 + (13728271209175808*sin((5270717853328913*x)/33554432))/829022619406361 + (((2927114230116077*sin((3294198658330571*x)/4194304))/16 + (8956713847111951*sin((3953038389996685*x)/8388608))/4 + 52261333536822824*sin((5270717853328913*x)/33554432))*((1259161868530272436224*x)/283303674451637 + (5720530583262469*sin((3294198658330571*x)/4194304))/79586171463010656 + (1890191513553995*sin((3953038389996685*x)/8388608))/2487067858219083 - (1284198312245721*sin((5270717853328913*x)/8388608))/106114895284014208 - (788820049541845*sin((5270717853328913*x)/16777216))/9948271432876332 + (13728271209175808*sin((5270717853328913*x)/33554432))/829022619406361 + (((1343318374775049260107797263568950807725342720*x)/6676171946239829 - 25783765124455804)*((2927114230116077*sin((3294198658330571*x)/4194304))/1152921504606846976 + (8956713847111951*sin((3953038389996685*x)/8388608))/288230376151711744 + (6532666692102853*sin((5270717853328913*x)/33554432))/9007199254740992))/2487067858219083 - (440706653985595377864088223744*power(x,2))/1983125721161459 - 4842029219725213/8589934592))/2487067858219083 - (440706653985595377864088223744*power(x,2))/1983125721161459 - 2897132367089491/70368744177664))/2487067858219083 - (440706653985595377864088223744*power(x,2))/1983125721161459 - 5794264734608811/140737488355328))/2487067858219083 - (440706653985595377864088223744*power(x,2))/1983125721161459 - 5794264734608831/140737488355328))/2487067858219083 - (440706653985595377864088223744*power(x,2))/1983125721161459 - 5794264734608831/140737488355328) + (61974373216724350012137406464*power(x,2))/8079879893910767 + 789/1000
plot(x,z)
how do i get plot i got an error Error using * Inner matrix dimensions must agree. by plot i can compare adjacent value of y(i) and by this i can know that iteration is performed well or not i am also attaching a file in which all the modification have been considered
Walter Roberson
2017 年 2 月 10 日
... I am not ignoring you ;-)
I have not had a chance to work with your latest version. The version before had the same kinds of problems as earlier. Your internal frequency was about 2E-8 according to some tests I did (that is, x + 1E-8 would be half a phase away from x), but when I looked at it mathematically it appeared that the frequency should be even higher than that. Even with n = 6, you were not getting convergence at all; you were getting divergence for sure, according to my tests. As such it is pointless to define convergence as minima less than 1E-4 apart, as that is at least 5000 cycles with some major value differences over that range.
I have been trying to see if I can come up with a usable hypothesis of how far apart the extremest minima are for a sum of sin with rational (but non-integer) multiples of pi. The sign of the terms matter, but the location of the extremest minima (where all of the cycles negatively reinforce each other) does not appear to depend upon the multiplier of the sin terms otherwise. The idea is that since you know all of the fractions that are going into the sin(Fraction*pi*x) terms, that it ought to be possible to predict the x at which there is the greatest minima... or at least to figure out what the period is.
Anyhow, it is taking a while, but at least up to before your most recent version (which I haven't read) your approach was not working.
NILESH PANDEY
2017 年 2 月 10 日
Sir, Thanks for your analysis and time,although as i went through your previous comment some things i couldn't understand. i am trying to understand your views. meantime if i got any other idea which can help this problem i'll defiantly share that. looking forward to your opinion.
and again Thanks for your effort and time
Walter Roberson
2017 年 2 月 11 日
Your vpay(6) has a frequency between 2E-8 to 4E-8 (it is higher frequency right near 0.)
Your vpay(2), vpay(4), and vpay(6) have greatly increasing oscillations towards the right end of the range. The greatest minima for them is within a relatively small number of cycles of the right end of whatever range you are using.
Yes, you could find the absolute minimum value over any given range, but not in any useful form.
The more terms you add, the greater the oscillations.
The formula being produced by your code are diverging, not converging, over the range you calculate.
Note: sometimes there are formula that have larger and larger values for the first few hundred terms, but which converge after that, so I cannot say at the moment that your formula is definitely wrong.
I can say, though, that if you were to try to calculate your values numerically instead of with the symbolic toolbox, that round off error would lead to garbage results.
NILESH PANDEY
2017 年 2 月 11 日
Thanks for your opinion i am also doing some test on my project which is the base of this code as soon i get any results that may help i'll share with you also Sir if you have anything more that can guide me You Are Most Welcome Thank You
NILESH PANDEY
2017 年 2 月 12 日
編集済み: NILESH PANDEY
2017 年 2 月 13 日
*NOTE*
Sir, after your analysis i started working on my previous work which was related to this code,when i went in depth of mathematics i have found there is some mistakes have been made in literature of this classic math which was published by some scientists on ieee. after finding the mistakes i have sent a copy of these to California Berkeley University Professor he also agreed with me,now we are working on this how to overcome mistakes so i suggested you if you are working on my code please hold this for a little more time although algorithm will be same but the values of constant will be different.
and sir thank you for your analysis after your guidance i focused my attention more on base of this mathematics and i found mistakes if you didn't guide me then may be i never bothered about this. when i'll overcome from the mistakes and i got correct code i'll discuss with You and my apologize for taking your time on a wrong code
*and also if any one working on this code kindly hold your work until i solve correct mathematics *
参考
タグ
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 (한국어)