Items tagged with matlab matlab Tagged Items Feed

Hello,

I am trying to medel a mechanical system using parametric relations. Unfrotunately in some cases, the relations and equations become too lengthy. Maple calculates the relations but when I try to convert them to MATLAB language an error message appears. I have uploaded corresponding file in maple. As can be seen in this file, an error message appeard after trying to convert to MATLAB language. In some cases, for example C22, the relations are too length so that maple cannot show them. Do you have any idea to overcome this problem?

Thanks in advance.

P1.mw

 

why can not draw graph in maple in this case and how to plot graph with matlab in maple

with(StringTools);
with(FileTools);
with(Matlab);
openlink();
evalM(sprintf("load fisheriris;X = meas(:,3:4);figure;plot(X(:,1),X(:,2),'k*','MarkerSize',5);"));
closelink();

 

how to call matlab to run k means on the data and

how to show which circle do the row of data belong to?

The help of maple software is not so clear , and I cant understand the exact way which leads to exporting a matrix from maple to matlab. more precisely how I can link between maple and matlab .

would you please with an example show me the rule.

hello everyone, I have problem in my project written by matlab to solving my equations with rang-kuta 4 order method. I send my project file.  please help me to run it correctly. thank you.

input Q_j n j V Z F_ve a_1 a_2 p_1 p_2 L A f m k c h t i;

for jj=1:n;

            s=Q_j(jj);

end

b=(-V)*Z;

o=(F_ve*A)*(((a_1^2)*p_1)-((a_2^2)*p_2))/L;

% RK4 method;

% md2z/dt2+cdz/dt+kz=f;

% dz_1/dt=z_2;

% mdz_2/dt+cdz_1/dt+z_1k=f;

% dz_2/dt=1/m(f-cz_2-kz_1);

f=0;

m=1;

k=s+b+o;

c=0;

h=0.5;

t=0:0.5:t;

z1=zeros (1,n);

z2=zeros (1,n);

z1 (1)=0;

z2 (1)=1;

% N=length (t);

f1=@(t,z1,z2)z2;

f2=@(t,z1,z2)f-(c*z2)-(k*z1);

for i=1:n-1;

    k1=f1 (t (i),z1 (i),z2 (i));

    m1=f2 (t (i),z1 (i),z2 (i));

    k2=f1 (t (i)+h/2,z1 (i)+0.5*k1*h,z2 (i)+0.5*m1*h);

    m2=f2 (t (i)+h/2,z1 (i)+0.5*k1*h,z2 (i)+0.5*m1*h);

    k3=f1 (t (i)+h/2,z1 (i)+0.5*k2*h,z2 (i)+0.5*m2*h);

    m3=f2 (t (i)+h/2,z1 (i)+0.5*k2*h,z2 (i)+0.5*m2*h);

    k4=f1 (t (i)+h,z1 (i)*k3*h,z2 (i)*m3*h);

    m4=f2 (t (i)+h,z1 (i)*k3*h,z2 (i)*m3*h);

    z1 (i+1)=z1 (i)+(h/6)*(k1+(2*k2)+(2*k3)+k4);

    z2 (i+1)=z2 (i)+(h/6)*(m1+(2*m2)+(2*m3)+m4);

end

plot (t,z1)

plot (t,z2)

plot (z,t)

 

 

 

 

Hello,

 

I wonder if it is possible to create standalone executables in Maple that would run in a  computer without Maple. Also if it is possible can we do that with Matlab code in it too?  

 

Matlab does not allow to create standalone executable is you use symbolic toolbox and I want to find a solution for that. What I will need to take second derivatives and get the coefficients of polynomials. 

I have been puzzled by a matlab toolbox problem for a long time. How can I get Maple notation in matlab output?

Both "Input display" and "Output display" in Tools-->Options-->Display was changed from "2-D Math notation" into "Maple notation". And the output in Maple is indeed Maple notation like this:maple output

But the output in matlab is also 2-D notation like this:matlab output

when copy it to Matlab or Maple as input, it become the wrong issues like this:wrong style

How can I output Maple notation in matlab? The version is Maple 18 and Matlab 2014b, respectively.

 

 


Hi
Please give me the matlab coding for plot together of attach figure by matlab.fig
thanks...!

Does the installation of Maple toolbox for matlab removes MuPad in matlab? 

Now when I type in mupad in matlab, it says undefined function.

Is there a way to keep both?

Hi

I am trying to optimize a 39, 1 MATLAB matrix, but cannot seem to get a result beyond a 6, 1 matrix. I am getting "Warning, cannot resolve types, reassigning t##'s type" where t## varies from each time I run it, and can show multiple of these warnings. It also says "Warning, cannot translate list".

 

I found a pretty similar problem posted here earlier, where the user "Carl Love" suggested to replace a command from the original code with

Matlab(
     subsop([-1,1]= J, eval([codegen:-optimize](tmp, tryhard), pow= `^`)),
     output = string, defaulttype = numeric
);

 

I was wondering what exactly this command does? Can I apply it to my code to solve my problem? It yielded a result that looks (on the surface) as an optimized code, but I don't feel completely comfortable using it without being certain.

What I have done is simply to replace Matlab(tmp, optimize) with the suggested code above. My code is attached. Thanks in advance for any help.

OptiMatrix.mw

I am having some issues trying to convert this matlap code into Maple code, can somebody help me out?

% Solve v'(t)=-0.0207v(t)^2-893.58 with y0=0
clc;
y0 = 0;                  % Initial Condition
h = 0.1;                 % Time step
t = 0:h:5;               % t goes from 0 to 5 seconds.
vstar = zeros(size(t)); % Preallocate array (good coding practice)
vstar(1) = y0;           % Initial condition gives solution at t=0.
for i=1:(length(t)-1)
    k1 = 0.0207*vstar(i)^2-893.58; % Previous approx for y gives approx for derivative
    vstar(i+1) = vstar(i) + k1*h; % Approximate solution for next value of y
end
figure(1)
plot(t,vstar);
y0 = 0;                  % Initial Condition
h = 0.05;                 % Time step
t = 0:h:5;               % t goes from 0 to 5 seconds.
vstar = zeros(size(t)); % Preallocate array (good coding practice)
vstar(1) = y0;           % Initial condition gives solution at t=0.
for i=1:(length(t)-1)
    k1 = 0.0207*vstar(i)^2-893.58; % Previous approx for y gives approx for derivative
    vstar(i+1) = vstar(i) + k1*h; % Approximate solution for next value of y
end
figure(2)
plot(t,vstar);

Hi, I am completely new to Maple, and I need to use it to optimize my equations in order to make my PLC codes more compressed. I am calculating forward kinematics with the Denavit-Hartenberg method and as such I get long expressions. After a lot of google'ing and frustration, I thought I'd ask here in the hope that one of you might be able to assist me.

I have the following equations;

X := L10*cos(q5) - L16*(sin(q10)*(sin(q5)*sin(q8) - cos(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) - cos(q10)*(sin(q9)*(cos(q8)*sin(q5) + sin(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) + cos(q9)*(cos(q5)*cos(q6)*sin(q7) + cos(q5)*cos(q7)*sin(q6)))) - d2*(cos(q10)*(sin(q5)*sin(q8) - cos(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) + sin(q10)*(sin(q9)*(cos(q8)*sin(q5) + sin(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) + cos(q9)*(cos(q5)*cos(q6)*sin(q7) + cos(q5)*cos(q7)*sin(q6)))) + L15*(sin(q9)*(cos(q8)*sin(q5) + sin(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) + cos(q9)*(cos(q5)*cos(q6)*sin(q7) + cos(q5)*cos(q7)*sin(q6))) - L11*cos(q5)*sin(q6) + d1*cos(q5)*cos(q6) - L13*sin(q5)*sin(q8) + L14*cos(q9)*(cos(q8)*sin(q5) + sin(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) + L13*cos(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7)) - L14*sin(q9)*(cos(q5)*cos(q6)*sin(q7) + cos(q5)*cos(q7)*sin(q6)) + L12*cos(q5)*cos(q6)*cos(q7) - L12*cos(q5)*sin(q6)*sin(q7);

Y := L10*sin(q5) - L9 + L16*(sin(q10)*(cos(q5)*sin(q8) - cos(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) - cos(q10)*(sin(q9)*(cos(q5)*cos(q8) + sin(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) - cos(q9)*(cos(q6)*sin(q5)*sin(q7) + cos(q7)*sin(q5)*sin(q6)))) + d2*(cos(q10)*(cos(q5)*sin(q8) - cos(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) + sin(q10)*(sin(q9)*(cos(q5)*cos(q8) + sin(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) - cos(q9)*(cos(q6)*sin(q5)*sin(q7) + cos(q7)*sin(q5)*sin(q6)))) - L15*(sin(q9)*(cos(q5)*cos(q8) + sin(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) - cos(q9)*(cos(q6)*sin(q5)*sin(q7) + cos(q7)*sin(q5)*sin(q6))) + L13*cos(q5)*sin(q8) - L11*sin(q5)*sin(q6) + d1*cos(q6)*sin(q5) - L14*cos(q9)*(cos(q5)*cos(q8) + sin(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) - L13*cos(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5)) - L14*sin(q9)*(cos(q6)*sin(q5)*sin(q7) + cos(q7)*sin(q5)*sin(q6)) + L12*cos(q6)*cos(q7)*sin(q5) - L12*sin(q5)*sin(q6)*sin(q7);

Z := L15*(cos(q9)*(cos(q6)*cos(q7) - sin(q6)*sin(q7)) - sin(q8)*sin(q9)*(cos(q6)*sin(q7) + cos(q7)*sin(q6))) - L11*cos(q6) - L8 - d1*sin(q6) + L16*(cos(q10)*(cos(q9)*(cos(q6)*cos(q7) - sin(q6)*sin(q7)) - sin(q8)*sin(q9)*(cos(q6)*sin(q7) + cos(q7)*sin(q6))) - cos(q8)*sin(q10)*(cos(q6)*sin(q7) + cos(q7)*sin(q6))) - d2*(sin(q10)*(cos(q9)*(cos(q6)*cos(q7) - sin(q6)*sin(q7)) - sin(q8)*sin(q9)*(cos(q6)*sin(q7) + cos(q7)*sin(q6))) + cos(q8)*cos(q10)*(cos(q6)*sin(q7) + cos(q7)*sin(q6))) - L13*cos(q8)*(cos(q6)*sin(q7) + cos(q7)*sin(q6)) - L14*sin(q9)*(cos(q6)*cos(q7) - sin(q6)*sin(q7)) - L12*cos(q6)*sin(q7) - L12*cos(q7)*sin(q6) - L14*cos(q9)*sin(q8)*(cos(q6)*sin(q7) + cos(q7)*sin(q6));

 

I need to optimize these equations, but still keep them separate. I would like to use mutual expressions for the calculations within, but still as I said keep the outputs of X, Y and Z separate.

This is MATLAB code.

 

Thanks in advance for any help.

Matlab seems to be pretty strong at doing color plots with separate color bars, e.g.

Is this also possible in Maple and somehow in combination with `plots[surfdata](...,color=zhue,...)`?

Hi,

Thank you very much for your idea in previous discussion: this is the link.

http://www.mapleprimes.com/questions/202744-Calculs-Using-Maple

I asked how can I plot the phase portrait of this system

Sys1 := {diff(r(t),t) = r(t)^2*sin(theta(t)), diff(theta(t),t) = -r(t)^2*(-2*cos(theta(t))^2+1)};

I get this answer:

 

1) For me it's not necessary to give an initial condition to plot the pharse portrait.

2) What is the line in this phase portrait.

3) Here, I try a second method using Matlab code, I get:

 

and this is the code:

[r, theta] = meshgrid(0:pi/4:2*pi, 0:pi/4:2*pi);
rdot =r.^2.*sin(theta) ;
thetadot = r.^2.*(1-2*sin(theta).^2);
quiver(r,theta,rdot,thetadot)
xlabel('r')
ylabel('theta')

the arrow in the phase portrait are not the same.

Can someone give me more clear information about this problem.

Many thinks.

 

Hi! I have a matlab worksheet that i need to convert it to Maplesoft. Is it possible?

Regards

Hikmat

1 2 3 4 5 6 Page 1 of 6