سؤال بسيط بالفور لووب

عفوا اخي
بس هي 12 عمود بس كما هي عندي
ثانيا انا لا يظهر عندي التكرار الذي تتكلم عنه

يمكن الكود يختلف بيننا
انا هذا هو الكود الذي اخذته منك

[FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]
close [/size][/font][/size][/font][FONT=Courier New][SIZE=2][COLOR=#a020f0][FONT=Courier New][SIZE=2][COLOR=#a020f0][FONT=Courier New][SIZE=2][COLOR=#a020f0]all
[/color][/size][/font][/color][/size][/font][/color][/size][/font][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]clear [/size][/font][/size][/font][FONT=Courier New][SIZE=2][COLOR=#a020f0][FONT=Courier New][SIZE=2][COLOR=#a020f0][FONT=Courier New][SIZE=2][COLOR=#a020f0]all
[/color][/size][/font][/color][/size][/font][/color][/size][/font][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]clc
phi=input ([/size][/font][/size][/font][FONT=Courier New][SIZE=2][COLOR=#a020f0][FONT=Courier New][SIZE=2][COLOR=#a020f0][FONT=Courier New][SIZE=2][COLOR=#a020f0]'Enter the latitude: '[/color][/size][/font][/color][/size][/font][/color][/size][/font][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]); [/size][/font][/size][/font][FONT=Courier New][SIZE=2][COLOR=#228b22][FONT=Courier New][SIZE=2][COLOR=#228b22][FONT=Courier New][SIZE=2][COLOR=#228b22]% phi is the latitude which i a given value
[/color][/size][/font][/color][/size][/font][/color][/size][/font][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]for[/color][/size][/font][/color][/size][/font][/color][/size][/font][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][COLOR=#000000] i=1:365[/color]
delta(i)=23.45*sind(((284+i)/365)*360) ;[/size][/font][/size][/font][FONT=Courier New][SIZE=2][COLOR=#228b22][FONT=Courier New][SIZE=2][COLOR=#228b22][FONT=Courier New][SIZE=2][COLOR=#228b22]%(checked OK);
[/color][/size][/font][/color][/size][/font][/color][/size][/font][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]omegasun(i)=(24/360)*acosd(-tand(phi)*tand(delta(i)));
daylength(i)=omegasun(i)*2;
sunrise(i)=12-omegasun(i);
sunset(i)=12+omegasun(i);
dh(i,(1:daylength(i)))=linspace(sunrise(i),sunset(i),daylength(i));
clc
[/size][/font][/size][/font][FONT=Courier New][SIZE=2][COLOR=#228b22][FONT=Courier New][SIZE=2][COLOR=#228b22][FONT=Courier New][SIZE=2][COLOR=#228b22]% length(dh)
[/color][/size][/font][/color][/size][/font][/color][/size][/font][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][/size][/font][/size][/font][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]for[/color][/size][/font][/color][/size][/font][/color][/size][/font][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] j=1:size(dh,2)
nhfn(i,j)=dh(i,j)-12;
omega(i,j)=nhfn(i,j)*360/24; [/size][/font][/size][/font][FONT=Courier New][SIZE=2][COLOR=#228b22][FONT=Courier New][SIZE=2][COLOR=#228b22][FONT=Courier New][SIZE=2][COLOR=#228b22]% where nhfn means number of hours from the noon, it is positive afternoon and negative before the noon
[/color][/size][/font][/color][/size][/font][/color][/size][/font][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]theta(i,j)=acosd((cosd(phi)*cosd(delta(i))*cosd(omega(i,j)))+(sind(phi)*sind(delta(i)))); [/size][/font][/size][/font][FONT=Courier New][SIZE=2][COLOR=#228b22][FONT=Courier New][SIZE=2][COLOR=#228b22][FONT=Courier New][SIZE=2][COLOR=#228b22]%(checked OK)
[/color][/size][/font][/color][/size][/font][/color][/size][/font][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][/size][/font][/size][/font][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/color][/size][/font][/color][/size][/font][/color][/size][/font][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] theta(i,j)>=90 
theta(i,j) = theta(i,j)-90;
[/size][/font][/size][/font][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]else
[/color][/size][/font][/color][/size][/font][/color][/size][/font][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][/size][/font][/size][/font][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]end
[/color][/size][/font][/color][/size][/font][/color][/size][/font][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]nr=1.33;
r(i,j)=asind((sind(theta(i,j))/nr)); [/size][/font][/size][/font][FONT=Courier New][SIZE=2][COLOR=#228b22][FONT=Courier New][SIZE=2][COLOR=#228b22][FONT=Courier New][SIZE=2][COLOR=#228b22]% the solar radiation Qsr is assumed to be full absorbed by the storage zone
[/color][/size][/font][/color][/size][/font][/color][/size][/font][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]cc(i,j)=1/(cosd(r(i,j))+nr*cosd(theta(i,j)));
dc(i,j)=1/(cosd(theta(i,j))+nr*cosd(r(i,j)));
tau(i,j)=2*nr*cosd(theta(i,j))*cosd(r(i,j))*((cc(i,j))^2+(dc(i,j))^2);
[/size][/font][/size][/font][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]end
[/color][/size][/font][/color][/size][/font][/color][/size][/font][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][/size][/font][/size][/font][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]end

[/color][/size][/font][/color][/size][/font][/color][/size][/font]

وانتظر قليلا سادرج لك النتائج التي تظهر

هذه هي النتائج كما تظهر عندي
لا اصفار ولا تكرار

tau(340:365,2:12)
ans =
    0.8162    0.9503    0.9746    0.9790    0.9796    0.9790    0.9746    0.9503    0.8162    0.9799    0.8858
    0.8160    0.9503    0.9746    0.9790    0.9796    0.9790    0.9746    0.9503    0.8160    0.0000    0.8868
    0.8158    0.9502    0.9745    0.9790    0.9796    0.9790    0.9745    0.9502    0.8158    0.9799    0.8877
    0.8156    0.9501    0.9745    0.9789    0.9795    0.9789    0.9745    0.9501    0.8156    0.9799    0.8885
    0.8154    0.9500    0.9745    0.9789    0.9795    0.9789    0.9745    0.9500    0.8154    0.9799    0.8893
    0.8152    0.9500    0.9745    0.9789    0.9795    0.9789    0.9745    0.9500    0.8152    0.9799    0.8900
    0.8151    0.9499    0.9744    0.9789    0.9795    0.9789    0.9744    0.9499    0.8151    0.9799    0.8906
    0.8149    0.9498    0.9744    0.9789    0.9795    0.9789    0.9744    0.9498    0.8149    0.9799    0.8911
    0.8148    0.9498    0.9744    0.9789    0.9795    0.9789    0.9744    0.9498    0.8148    0.9799    0.8916
    0.8147    0.9498    0.9744    0.9789    0.9795    0.9789    0.9744    0.9498    0.8147    0.9799    0.8920
    0.8146    0.9497    0.9744    0.9789    0.9795    0.9789    0.9744    0.9497    0.8146    0.0000    0.8923
    0.8146    0.9497    0.9744    0.9789    0.9795    0.9789    0.9744    0.9497    0.8146    0.9799    0.8926
    0.8145    0.9497    0.9744    0.9789    0.9795    0.9789    0.9744    0.9497    0.8145    0.0000    0.8928
    0.8145    0.9497    0.9744    0.9789    0.9795    0.9789    0.9744    0.9497    0.8145    0.9799    0.8929
    0.8145    0.9497    0.9744    0.9789    0.9795    0.9789    0.9744    0.9497    0.8145    0.9799    0.8930
    0.8145    0.9497    0.9744    0.9789    0.9795    0.9789    0.9744    0.9497    0.8145    0.0000    0.8930
    0.8145    0.9497    0.9744    0.9789    0.9795    0.9789    0.9744    0.9497    0.8145    0.9799    0.8930
    0.8145    0.9497    0.9744    0.9789    0.9795    0.9789    0.9744    0.9497    0.8145    0.0000    0.8929
    0.8145    0.9497    0.9744    0.9789    0.9795    0.9789    0.9744    0.9497    0.8145    0.9799    0.8927
    0.8146    0.9497    0.9744    0.9789    0.9795    0.9789    0.9744    0.9497    0.8146    0.9799    0.8925
    0.8147    0.9497    0.9744    0.9789    0.9795    0.9789    0.9744    0.9497    0.8147    0.9799    0.8921
    0.8148    0.9498    0.9744    0.9789    0.9795    0.9789    0.9744    0.9498    0.8148    0.9799    0.8918
    0.8149    0.9498    0.9744    0.9789    0.9795    0.9789    0.9744    0.9498    0.8149    0.0000    0.8913
    0.8150    0.9499    0.9744    0.9789    0.9795    0.9789    0.9744    0.9499    0.8150    0.9799    0.8908
    0.8151    0.9499    0.9745    0.9789    0.9795    0.9789    0.9745    0.9499    0.8151    0.0000    0.8903
    0.8153    0.9500    0.9745    0.9789    0.9795    0.9789    0.9745    0.9500    0.8153    0.9799    0.8896

انا مستغرب من كلامك
وضحلي ارجوك

شكرا لك اخي سعود

انا نسخت نفس الكود والصقته في الماتلاب اللي عندي واعطى تكرار نفس المشكلة ووضعت العمود الاخير ايضا للتوضيح اكثر

انظر النتائج


>> tau(340:365,2:13)
ans =
    0.7380    0.9064    0.9508    0.9628    0.9628    0.9508    0.9064    0.7380    0.9799    0.4919    0.4919    0.4919
    0.7373    0.9060    0.9506    0.9627    0.9627    0.9506    0.9060    0.7373    0.9799    0.4867    0.4867    0.4867
    0.7367    0.9056    0.9504    0.9625    0.9625    0.9504    0.9056    0.7367    0.9799    0.4817    0.4817    0.4817
    0.7361    0.9053    0.9501    0.9623    0.9623    0.9501    0.9053    0.7361    0.9799    0.4771    0.4771    0.4771
    0.7355    0.9050    0.9499    0.9622    0.9622    0.9499    0.9050    0.7355    0.9799    0.4728    0.4728    0.4728
    0.7351    0.9046    0.9498    0.9621    0.9621    0.9498    0.9046    0.7351    0.9799    0.4689    0.4689    0.4689
    0.7346    0.9044    0.9496    0.9619    0.9619    0.9496    0.9044    0.7346    0.9799    0.4653    0.4653    0.4653
    0.7342    0.9041    0.9494    0.9618    0.9618    0.9494    0.9041    0.7342    0.9799    0.4621    0.4621    0.4621
    0.7339    0.9039    0.9493    0.9617    0.9617    0.9493    0.9039    0.7339    0.9799    0.4592    0.4592    0.4592
    0.7336    0.9037    0.9492    0.9616    0.9616    0.9492    0.9037    0.7336    0.9799    0.4568    0.4568    0.4568
    0.7333    0.9036    0.9491    0.9616    0.9616    0.9491    0.9036    0.7333    0.0000    0.4547    0.4547    0.4547
    0.7331    0.9034    0.9490    0.9615    0.9615    0.9490    0.9034    0.7331    0.9799    0.4530    0.4530    0.4530
    0.7329    0.9033    0.9490    0.9615    0.9615    0.9490    0.9033    0.7329    0.9799    0.4517    0.4517    0.4517
    0.7328    0.9033    0.9489    0.9614    0.9614    0.9489    0.9033    0.7328    0.9799    0.4508    0.4508    0.4508
    0.7328    0.9032    0.9489    0.9614    0.9614    0.9489    0.9032    0.7328    0.9799    0.4503    0.4503    0.4503
    0.7328    0.9032    0.9489    0.9614    0.9614    0.9489    0.9032    0.7328    0.0000    0.4502    0.4502    0.4502
    0.7328    0.9032    0.9489    0.9614    0.9614    0.9489    0.9032    0.7328    0.9799    0.4505    0.4505    0.4505
    0.7329    0.9033    0.9489    0.9614    0.9614    0.9489    0.9033    0.7329    0.9799    0.4512    0.4512    0.4512
    0.7330    0.9034    0.9490    0.9615    0.9615    0.9490    0.9034    0.7330    0.9799    0.4523    0.4523    0.4523
    0.7332    0.9035    0.9491    0.9615    0.9615    0.9491    0.9035    0.7332    0.9799    0.4538    0.4538    0.4538
    0.7334    0.9036    0.9491    0.9616    0.9616    0.9491    0.9036    0.7334    0.9799    0.4557    0.4557    0.4557
    0.7337    0.9038    0.9492    0.9617    0.9617    0.9492    0.9038    0.7337    0.9799    0.4580    0.4580    0.4580
    0.7340    0.9040    0.9494    0.9618    0.9618    0.9494    0.9040    0.7340    0.9799    0.4606    0.4606    0.4606
    0.7344    0.9042    0.9495    0.9619    0.9619    0.9495    0.9042    0.7344    0.9799    0.4637    0.4637    0.4637
    0.7348    0.9045    0.9497    0.9620    0.9620    0.9497    0.9045    0.7348    0.9799    0.4671    0.4671    0.4671
    0.7353    0.9048    0.9498    0.9621    0.9621    0.9498    0.9048    0.7353    0.9799    0.4708    0.4708    0.4708
 

الاعمدة الثلاث الاخيرة هي تكرار في كل صف

استخدم النسخة 7

والجامعة اشتروا لي النسخة 2009

وماودي اركبها الان حتى اكمل الجزء هذا

جزاك الله خير اخي سعود واشكرك

انا مستغرب
من وين بتجيب الرقم
13

مالمسئول باعلم من السائل
العم ماتلاب ماله مزاج يشتغل عندي

انا اخذت نفس الكود اللي حطيته نسخ ولصق وطلع لي النتائج

هل هذا فرق في الاعدادات مثلا

او مشكلة في نسختي

وهل يوجد نسخة نظيفة تعطيني رابطها

لاني نسختي الجديدة مايحق لي الا اركبها في جهاز واحد وممكن اركبها في جهاز المكتب

واركب النسخة اللي ترشدني لها في اللاب توب

الله يحفظك يا سعود

اخوي المهندس سعود

انا اليوم حملت احدث نسخة

وبرضووو نفس المشكله

اغتقد الفور لووب فيه مشكله

استخدم القيمة المدخلة 29 وشوف يمكن تستخدم انت قيمة صغيرة

الحمد لله انحلت بتغيير حدود ال j

بعد تركيب النسخة الحديثة لاني اول كنت احاول فيها ما يرضى بس بعد النسخة الجديدة انحلت

الف شكر اخوي سعود

الحمد لله

جزاك الله الف خير خوي سعود واتمني ان تعطينا امثلة متنوعة عن استخدام اللوب

يسلموا على الفكرة