help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: be brief


From: Nicholas Jankowski
Subject: Re: be brief
Date: Thu, 23 Jul 2015 19:03:24 -0400

On Thu, Jul 23, 2015 at 6:38 AM, <address@hidden> wrote:

From: Nicholas Jankowski <address@hidden>
To: address@hidden
Cc: "address@hidden" <address@hidden>
Sent: Wednesday, 22 July 2015, 19:15:56
Subject: Re: be brief

On Tue, Jul 21, 2015 at 5:37 PM, <address@hidden> wrote:


hello.
plz be brief and short my program that writed with MATLAB language.
i am waiting for you
my program:

 
     f1=inline('-3.9*m*t/(z^2)-1.2*m*a/(z^2)-14.5*m*b/(z^2)-1.34*m*s/(z^2)','m','t','a','b','s');
 
     z=1+3.3a+13.6b+33.3f+215c
    

     f2=inline('-3.9*m*t/(z^2)','m','t');
   
     z=1+3.3a+13.6b+33.3f+215c
    

     f3=inline('3.9*m*t/(z^2)-0.9*b/(z^2)-1.2*m*a/(z^2)','m','t','b','a')
     z=1+3.3a+13.6b+33.3f+215c
   

     f4=inline('2.3*b/(z^2)-1.34*m*s/(z^2)','b','m','s')
     z=1+3.3a+13.6b+33.3f+215c  


     f5=inline('0.9*a/(z^2)-14.5*m*b/(z^2)-2.3*b/(z^2)','a','m','b')
    
     z=1+3.3a+13.6b+33.3f+215c 

     f6=inline('1.2*a*m/(z^2)+14.5*m*b/(z^2)+1.34*m*f/(z^2)','a','m','b','s')

     z=1+3.3a+13.6b+33.3f+215c

 
       
     m(1)=3.8;
     t(1)=6.2;
     a(1)=0;
     s(1)=0;
     b(1)=0;
     c(1)=0;
     h=0.01;
     y=0:h:20;

max=0;%max = Maximum for Selectivity of Para-xylene%
max2=0;%max2 = Maximum for Selectivity of Meta-xylene%
Obtimized_Length=1;
Obtimized_Length2=1;
for i=1:(length(y)-1)
    k11 = h*f1(m(i),t(i),a(i),b(i),s(i),c(i));
    k12 = h*f2(m(i),t(i),a(i),b(i),s(i),c(i));
    k13 = h*f3(m(i),t(i),a(i),b(i),s(i),c(i));
    k14 = h*f4(m(i),t(i),a(i),b(i),s(i),c(i));
    k15 = h*f5(m(i),t(i),a(i),b(i),s(i),c(i));
    k16 = h*f6(m(i),t(i),a(i),b(i),s(i),c(i));
   
    k21 = h*f1(m(i)+k11/2,t(i)+k12/2,a(i)+k13/2,b(i)+k14/2,s(i)+k15/2,c(i)+k16/2);
    k22 = h*f2(m(i)+k11/2,t(i)+k12/2,a(i)+k13/2,b(i)+k14/2,s(i)+k15/2,c(i)+k16/2);
    k23 = h*f3(m(i)+k11/2,t(i)+k12/2,a(i)+k13/2,b(i)+k14/2,s(i)+k15/2,c(i)+k16/2);
    k24 = h*f4(m(i)+k11/2,t(i)+k12/2,a(i)+k13/2,b(i)+k14/2,s(i)+k15/2,c(i)+k16/2);
    k25 = h*f5(m(i)+k11/2,t(i)+k12/2,a(i)+k13/2,b(i)+k14/2,s(i)+k15/2,c(i)+k16/2);
    k26 = h*f6(m(i)+k11/2,t(i)+k12/2,a(i)+k13/2,b(i)+k14/2,s(i)+k15/2,c(i)+k16/2);
   
    k31 = h*f1(m(i)+k21/2,t(i)+k22/2,a(i)+k23/2,b(i)+k24/2,s(i)+k25/2,c(i)+k26/2);
    k32 = h*f2(m(i)+k21/2,t(i)+k22/2,a(i)+k23/2,b(i)+k24/2,s(i)+k25/2,c(i)+k26/2);
    k33 = h*f3(m(i)+k21/2,t(i)+k22/2,a(i)+k23/2,b(i)+k24/2,s(i)+k25/2,c(i)+k26/2);
    k34 = h*f4(m(i)+k21/2,t(i)+k22/2,a(i)+k23/2,b(i)+k24/2,s(i)+k25/2,c(i)+k26/2);
    k35 = h*f5(m(i)+k21/2,t(i)+k22/2,a(i)+k23/2,b(i)+k24/2,s(i)+k25/2,c(i)+k26/2);
    k36 = h*f6(m(i)+k21/2,t(i)+k22/2,a(i)+k23/2,b(i)+k24/2,s(i)+k25/2,c(i)+k26/2);

    k41 = h*f1(m(i)+k31,t(i)+k32,a(i)+k33,b(i)+k34,s(i)+k35,c(i)+k36);
    k42 = h*f2(m(i)+k31,t(i)+k32,a(i)+k33,b(i)+k34,s(i)+k35,c(i)+k36);
    k43 = h*f3(m(i)+k31,t(i)+k32,a(i)+k33,b(i)+k34,s(i)+k35,c(i)+k36);
    k44 = h*f4(m(i)+k31,t(i)+k32,a(i)+k33,b(i)+k34,s(i)+k35,c(i)+k36);
    k45 = h*f5(m(i)+k31,t(i)+k32,a(i)+k33,b(i)+k34,s(i)+k35,c(i)+k36);
    k46 = h*f6(m(i)+k31,t(i)+k32,a(i)+k33,b(i)+k34,s(i)+k35,c(i)+k36);


    m(i+1) = m(i) + (1/6)*(k11+2*k21+2*k31+k41);
    t(i+1) = t(i) + (1/6)*(k12+2*k22+2*k32+k42);
    a(i+1) = a(i) + (1/6)*(k13+2*k23+2*k33+k43);
    b(i+1) = b(i) + (1/6)*(k14+2*k24+2*k34+k44);
    s(i+1) = s(i) + (1/6)*(k15+2*k25+2*k35+k45);
    c(i+1) = c(i) + (1/6)*(k16+2*k26+2*k36+k46);

   

    R1(i+1) = f1(m(i+1),t(i+1),a(i+1),b(i+1),s(i+1),c(i+1));
    R2(i+1) = f2(m(i+1),t(i+1),a(i+1),b(i+1),s(i+1),c(i+1));
    R3(i+1) = f3(m(i+1),t(i+1),a(i+1),b(i+1),s(i+1),c(i+1));
    R4(i+1) = f4(m(i+1),t(i+1),a(i+1),b(i+1),s(i+1),c(i+1));
    R5(i+1) = f5(m(i+1),t(i+1),a(i+1),b(i+1),s(i+1),c(i+1));
    R6(i+1) = f6(m(i+1),t(i+1),a(i+1),b(i+1),s(i+1),c(i+1));

spx(i)=a(i+1)/c(i+1);
    if spx(i)>max
        max=spx(i);
        i=Obtimized_Length;
    end
    smx(i)=b(i+1)/c(i+1);
    if smx(i)>max2
        max2=smx(i);
        i=Obtimized_Length2;
       
    end
end
disp('max is = ');
disp(max);
disp('max2 is = ');
disp(max2);
disp('Obtimized Length is = ');
disp(Obtimized_Length);
disp('Obtimized Length2 is = ');
disp(Obtimized_Length2);
    

_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave



That program would not run in matlab either.  (maybe with the Symbolic toolbox? but this is Octave, not Matlab)

you use variables before you assign values to them. this is not a symbolic algebra package. if you move the lines from m(1)=3.8 to y=0:h:20  up to the front of the program, at least all of your variable will be properly declared. Next, you cannot write :

3.3a

you have to write:

3.3*a

for all of the z equations.

next, why are you writing the same z = equation six times?  Last, the z equations use a variable f that you never declare.

Three may be more errors, but this is the most obvious initial problem that will prevent the program from even running.

Nick J.



> hello.thank u for your answer. it is matLAB Language.f1 to f6   which is one function that other place is
> writed.but i write it whole of program(all   of program).i want that underestand you.i want brief all 
> program, delete Additional commands for example k41 to 46.(i want that write all of in 1
> command).thanks

Please include help-octave.gnu.org in any replies. And the list expects your replies to appear at the end of the other messages.

It seems that English is not your first language. There may be someone on the list able to speak to you directly in your native language, please let us know what that is, and maybe try to repeat your question in that language.

Here's the best I can do:

What you have written does resemble Matlab and  Octave m-code. However, it does not run in either.

After correcting the 3.3a to 3.3*a as I said above,

the first error MATLAB gives you is:

undefined function or variable 'a'. 

this is because you're trying to use a before you've defined it. same with other variables.

if you move the following lines to the top of the file:
     m(1)=3.8;
     t(1)=6.2;
     a(1)=0;
     s(1)=0;
     b(1)=0;
     c(1)=0;
     h=0.01;
     y=0:h:20;

then, you get the error:

undefined function or variable 'f'

if you want it to be f1, f2, f3, ...  then you need to use that name in the equations for z.

Assuming you meant to use f1, f2, f3, f4, f5 and f6 in the equations for z, such as:

 z=1+3.3*a+13.6*b+33.3*f1+215*c

then, you get the error: 
Undefined operator '*' for input arguments of type 'inline'.

It does not like when you multiply by f1.


Because I do not know what problem you are trying to solve, I have no idea how to correct your model. As I said, it currently doesn't even run in Matlab. 

If it is making use of the Symbolic Toolbox, then maybe it would run, but I believe you still have to change the setup and the way you declare variables

Nick J.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]