f

#### Maple To Matlab Help

```Hi,  I am working on a code in Maple but am having trouble with its size.  I was hoping to try to run it in Matlab to see if it would do better.  I have only ever used matlab for very simple things and was looking for a little direction on how to translate this.  Posted is a small section of what I am trying to do.  The vector Mat2 is a filled with number 1 through 10.  I want to run a specific if/else routine for each number in Mat2, and fill in a matrix Mat3 as my output, which will be 4708 by 4708. The code runs does the entire array Mat2, and each time it encounters a 3 it creates a row in Mat3 with the values assigned. The output will mostly be zeros with 5 separate diagnols.  I tried to translate directly, but keep on getting errors.  Any help is appreciated. Thanks

> Mat2 := Reshape(Mat, 4708, 1);
> t := proc (i, j)
if Mat2(i) = 3 then
if i = j then -4
elif j = i+1 or j = i-1 or j = i+216 or j = i-216 then 1
else 0
end if
else 0
end if
end proc;
Mat3 := Matrix(4708, t, storage = sparse);
```
 0
4/6/2011 3:37:04 AM
comp.soft-sys.matlab 211264 articles. 26 followers. lunamoonmoon (257) is leader.

0 Replies
627 Views

Similar Articles

[PageSpeed] 16

Similar Artilces:

Need help for a matlab mini project
Hello everyone, I have a matlab in class exercise due in few days. I am new to matlab and the instructions provided with the assignment is minimal. Can Someone help me with the basic understanding as in how can I map the problem's solution to matlab script ? I am not able to post question here as it is a jpeg file. Please let me know and then we can discuss further. ...

Matlab help

MATLAB-help!!!
I am trying to write code to iterate a function 50 times, however, every time i write it without help i get ()-indexing must appear last in an index expression. I'm not sure what this means or how to fix it, can someone please explain. Also, my input is this: x(i)=a*x(i-1)(1-x(i-1)+h*x(i-1)^2/2) On Jan 24, 12:45=A0pm, michelle taylor <miss.smileyf...@gmail.com> wrote: > I am trying to write code to iterate a function 50 times, however, > every time i write it without help i get ()-indexing must appear last > in an index expression. > > I'm not sure what this means or how to fix it, can someone please > explain. > > Also, my input is this: > > x(i)=3Da*x(i-1)(1-x(i-1)+h*x(i-1)^2/2) Aren't you missing an operator? x(i)=3Da*x(i-1) here (1-x(i-1)+h*x(i-1)^2/2) x(i)=3Da*x(i-1)*(1-x(i-1)+h*x(i-1)^2/2) or x(i)=3Da*x(i-1)/(1-x(i-1)+h*x(i-1)^2/2) or x(i)=3Da*x(i-1)^(1-x(i-1)+h*x(i-1)^2/2) On Jan 23, 3:58=A0pm, TideMan <mul...@gmail.com> wrote: > On Jan 24, 12:45=A0pm, michelle taylor <miss.smileyf...@gmail.com> > wrote: > > > I am trying to write code to iterate a function 50 times, however, > > every time i write it without help i get ()-indexing must appear last > > in an index expression. > > > I'm not sure what this means or how to fix it, can someone please > > explain. > > > Also, my input is this: > > > x(i)=3Da*x(i-1)(1-x(i-1)+h*x(i-1)^2/...

Spawning matlab from within matlab
Hello all, I would like to spawn multiple matlab processes from an '.m' script. Meaning, run an m-file from a 'parent' Matlab that launches, say, 8 more 'children' matlab processes. I'd like to do it in such a way that the same m-file in the 'parent' is able to close down, or kill, all the 'children' processes. Any suggestions? Joe ...

Matlab engine with matlab R2010b
Hello All, I'm working with an aplication that use the matlab engine. I made the C++ program and it is working well in my pc with matlab 2007b, but the same very basic program shows an error when I tried to compile it in a pc with matlab R2010b. The error is about the icuuc32.dll. ¿Why is asking this DLL? How can I solve this?. Thanks¡ ...

embedded matlab function MATLAB R2009a
I downloaded the MS visual C++ 2008 Express Edition and the SDK as detailed in http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/?solution=1-6IJJ3L My embedded function didnt work at the beginning because I did "mex -setup" before I installed my SDK. But after I installed the SDK, I ran "mex -setup" in Matlab once again and choose the MS visual C++2008 as my compiler. Then, my embedded matlab function worked. Thanks to the contribution from above! ...

[JOB] Help
Hi all Sorry to advertise within the user group but I really need some help! I was hoping that people in this usergroup could help other fellow Matlab developers who may be looking for a new role, or might be interested in what I have on offer. I need to find a Application engineer who is a confident developer with Matlab and its toolboxes. Competent at explaining to people how and why they are doing things with the technology, able to solve complex problems with simple solutions. Plus, have have a burning desire for technology. Personally, I have been looking for this type of person for almost 4 months and I am almost ready to give in, but I wont be beaten! If anyone is a experienced within C++ / C or Java, and have a lot of experience with using Matlab, then please get in touch with me. My contact details are danielsheppard1983@gmail.com or call me on 0282523120 thanks for letting me post this, I just really needed the help Thanks Dan "Dan Sheppard" <danielsheppard1983@gmail.com> wrote in message news:bd137cfa-cbbb-4069-8d6b-3721cba3b17b@t8g2000pbe.googlegroups.com... > Hi all > > Sorry to advertise within the user group but I really need some help! > I was hoping that people in this usergroup could help other fellow > Matlab developers who may be looking for a new role, or might be > interested in what I have on offer. > > I need to find a Application engineer who is a confident developer >...

help with C# in matlab
Hello All, I have a C# (previously written) code (.cs) that can convert the raw file I want into cdf using .dll's that came along with the machine that creates the raw file. I developed a GUI in matlab to visualize and modify the data from the raw file, but the conversion tool (msconv) I am using seems slow. So I am trying to see if there is a way to be able to use the C# code along with the dll files and convert the data. An issue to consider is that there are no header files, only .dll files, so I cannot use LOADLIBRARY. I tried the Matlab Compiler as well. Does anyone have any ideas? I have never used C# before. Thank you, Mathew ...

code of matlab 7a not working in matlab 2009
I wrote a code in matlab 7a andand it was working over there then i changed computer which was having matlab realease 2009a and it is not working If i install Matlab 7 release 14, will my code work again thanks "moonman" wrote in message <ipmsl7\$23v\$1@fred.mathworks.com>... > I wrote a code in matlab 7a andand it was working over there > then i changed computer which was having matlab realease 2009a and it is not working > > If i install Matlab 7 release 14, will my code work again thanks Can you be more specific about the fact that your code is not working in 2009a but worked in 2007a? It would be helpful if you could narrow down what is not working in 2009a and provide error messages. Wayne ok thanks wyne i will send error message after some hours ...

how to do this in matlab
Number of column: 5 Vector A: [ 2 4 6 7 8 ] Vector B : [ 5 7 8 10 1] Choice = 1 : Find the highest value Vector A : 8 Vector B: 10 The highest value : 10 Choice = 2 : Find the lowest value Vector A : 2 Vector B: 1 The highest value : 1 Choice = 3 : Find the average value of : Vector A Vector B "Syamil " <syamilsaid@gmail.com> wrote in message <inq3g8\$hhd\$1@fred.mathworks.com>... > Number of column: 5 > Vector A: [ 2 4 6 7 8 ] > Vector B : [ 5 7 8 10 1] > > Choice = 1 : Find the highest value > Vector A : 8 > Vector B: 10 > The highest value : 10 > > Choice = 2 : Find the lowest value > Vector A : 2 > Vector B: 1 > The highest value : 1 > > Choice = 3 : Find the average value of : > Vector A > Vector B Type in matlab: doc min doc max doc mean ...

Matlab LVQ Help
Hi, I am new on neural network toolbox. I am trying to use LVQ algorithm,but it is not working at all. Right now I am trying to train the network for a simple sine curve, but it is not trained according to the target. Can you help me with your suggestion, my function is y=sin(x); x is my input and y is my target output. I classified target results in four different classes. 0.5<=value<=1.0; class 1 0.0<=value<0.5; class 2 -0.5<=value<0.0; class 3 -1<=value<-0.5; class 4 I would highly appriciate if you help me with some idea, i am stucked here for a long time. Here is the code I am using, --------------------------------------------------- t=-5:.1:5; x=t; for i=1:length(x) y(i)=sin(x(i)); end for i=1:1:length(y) if(0.5<(y(1,i)) && (y(1,i))<=1) tc1(1,i)=1; end end for i=1:1:length(y) if(0<=(y(1,i)) && (y(1,i))<0.5) tc1(1,i)=2; end end for i=1:1:length(y) if(-0.5<=(y(1,i)) && (y(1,i))<0) tc1(1,i)=3; end end for i=1:1:length(y) if(-1.0<=(y(1,i)) && (y(1,i))<-0.5) tc1(1,i)=4; end end p1=x; check(1,:)=p1; check(2,:)=tc1; checkall=sortrows(check,2); p=checkall(1,:); tc=checkall(2,:); t=ind2vec(tc); targets=full(t); sc=16; calu(1,1)=sum(targets(1,:)); calu(2,1)=sum(targets(2,:)); calu(3,1)=sum(targets(3,:)); calu(4,1)=sum(targets(4,:)); c1=calu(1,1)/(sum(calu(1,1)+calu(2,1)+calu(3,1)+calu(4,1))); c2=calu(2,1)/(sum(calu(1,1)+calu(2,1)+calu(3,1)+calu(4,1))); c3=calu...

creating GUI in matlab out of some programs written in matlab
I have written some code in matlab for my application. I want to make a graphical interface so that an user can easily use my code. I do not know, how to link my code or a particular function when user clicks on a particular button. I mean, how to assign a function written by me to a push button so that it will execute the function. And how to give the input to my function and get output after executing the particular function. I am quiet familiar with matlab code. But I am absolutely new with GUI in matlab. Please help me to deal with the above problem. On 4/12/2011 12:37 AM, sk maidul haque wrote: > I have written some code in matlab for my application. > I want to make a graphical interface so that an user can easily use my code. > I do not know, how to link my code or a particular function > when user clicks on a particular button. I mean, how to assign a > function written by me to a push button so that it will execute the function. > And how to give the input to my function and get output after > executing the particular function. > I am quiet familiar with matlab code. But I am absolutely new with > GUI in matlab. Please help me to deal with the above problem. Use GUIDE to make the gui. It is very simple and powerful to use. I use it all the time for my school projects and HW's. I know some prefer to code the thing by hand, but I prefer GUIDE. When you add a button in GUIDE, it will create a callback stub for you automatically...

Error in maple with matlab
Hi all, I am getting following error while executing the below line using matlab maple('m:=',m_char(j,:)); ??? Error using ==> maple at 178 Error using ==> maplemex `:` unexpected I am using matlab R2010a-windows 64bit and maple 15-windows 64bit and my OS windows7 please suggest some idea to resolve this problem...Thanks in advance... Kindly help us.... even I m also getting the same error..... Very thanks in advance.....please please please On 14.11.11 12:10, Nanthini wrote: > Hi all, > I am getting following error while executing the below line using matlab > > maple('m:=',m_char(j,:)); I'm just guessing, but maybe maple(['m:=',m_char(j,:)]); works better for you? Christopher ...

Matlab parallel for loop or Matlab open pool
I am trying to to some computations and I would like to do it in parallel using parfor or by Opening the matlabpool.. as the current implementations is too slow: result=zeros(25,16000); for i = 1:length(vector1) % length is 25 for j = 1:length(vector2) % length is 16000 temp1 = vector1(i); temp2 = vector2(j); t1 = load(matfiles1(temp1).name) %load image1 from matfile1 t2 = load(matfiles2(temp2).name) % load image2 from matfile2 result(i,j)=t1.*t2 end end It work fine but I would really like to know if there is a way to speed thing up ... Thanks a lot in advance! ...

matlab help in fsolve
this is my matlab main file: a=[]; for i=0:100:600 display(i); c0 = [i; 0; 0; 0; 0]; % Make a starting guess at the solution options=optimset('Display','iter'); % Option to display output [c] = fsolve(@myfunction,c0,options); % Call optimizer a=[a c(5)]; display(a); end i=0:100:600 display(a); %plot(i,a) plot(i,c(5,:)) function file is :: function F = myfunction(c) F = [ 2.2098e-004*c(1)^2*c(2)-2.2098e-004*c(1)*c(2)^2-2.2098e-004*c(1)*c(2)*4+2.2098e-004*c(1)*c(2)*13.533+ 7.3414e-004*c(3)*c(4)*4- 7.3414e-004*c(3)*c(4)*13.533-9.0343e-004*c(2)*c(3)*4- 7.3414e-004*c(1)*c(3)*c(4)+9.0343e-004*c(1)*c(2)*c(3)+ 7.3414e-004*c(2)*c(3)*c(4) 2.2098e-004*c(1)*c(2)*13.533- 7.3414e-004*c(3)*c(4)*13.533-9.0343e-004*c(2)*c(3)*13.533+ 0.0037*c(4)*c(5)*13.533-2.2098e-004*c(1)*c(2)^2+ 7.3414e-004*c(2)*c(3)*c(4)+9.0343e-004*c(2)^2*c(3)- 0.0037*c(2)*c(4)*c(5)-2.2098e-004*c(1)*c(2)*c(3)+ 7.3414e-004*c(3)^2*c(4)-9.0343e-004*c(2)*c(3)^2 + 0.0037*c(3)*c(4)*c(5) 2.2098e-004*c(1)*c(2)*c(3)- 7.3414e-004*c(3)^2*c(4)+9.0343e-004*c(2)*c(3)^2- 0.0037*c(3)*c(4)*c(5)-2.2098e-004*c(1)*c(2)*c(4)+ 7.3414e-004*c(3)*c(4)^2+9.0343e-004*c(2)*c(3)*c(4)- 0.0037*c(4)^2*c(5) 2.2098e-004*c(1)*c(2)*c(5)- 7.3414e-004*c(3)*c(4)*c(5)+9.0343e-004*c(2)*c(3)*c(5)- 0.0037*c(4)*c(5)^2-9.0343e-004*c(2)*c(3)*c(4)+ 0.0037*c(4)^2*c(5) -2.2098e-004*c(1)*c(2)*c(5)+ 7.3414e-004*c(3)*c(4)*c(5)+9.0343e-004*c(2)*c(3)*4- 0.0037*c(4)*c(5)*4-9.0343e-004*c(1)*c(2...

Maple Matlab toolbox
I have Matlab 2010a(64bit) and Maple 15(think 64bit, not sure). When I setup the matlab toolbox, it installs the 32 bit toolbox with maplemex.mex32 file. When I run the code, matlab searches for maplemex.mex64 bit file. Any idea how I can remedy this? I have Visual C++ 2008 Sp1 compiler setup on matlab. Thanks in advance. ...

matlab help #25
Hi there! I have a program which needs troubleshooting. I have been looking at every line over and over again but I cant seem to find the problem. I was wondering if anyone will be able to help me with it? My email is s0h.samu3l@gmail.com. Please email me so that I can better explain the problem. It's about a hundred lines long program. Look forward to your email! Thank you so much! "Samuel" wrote in message <ipbi41\$hq8\$1@fred.mathworks.com>... > Hi there! > > I have a program which needs troubleshooting. I have been looking at every line over and over again but I cant seem to find the problem. I was wondering if anyone will be able to help me with it? My email is s0h.samu3l@gmail.com. Please email me so that I can better explain the problem. It's about a hundred lines long program. Look forward to your email! > > Thank you so much! Hi Samuel, You should be able to troubleshoot the program down to a few lines and present us with those lines and the error message. Wayne "Wayne King" <wmkingty@gmail.com> wrote in message <ipbj9g\$6bf\$1@fred.mathworks.com>... > "Samuel" wrote in message <ipbi41\$hq8\$1@fred.mathworks.com>... > > Hi there! > > > > I have a program which needs troubleshooting. I have been looking at every line over and over again but I cant seem to find the problem. I was wondering if anyone will be able to help me with it? My email is s0h.samu3l@gmail.com. Ple...

MatLab help #27
Hi, I have a copy of a program that reads two small pngs and sends them out over two serial ports. It's old and its evidently a bad edit, so could someone please tell me what's the matter with this crazy thing?! It seems to be in the variables and then it blows its cool in the reshape command. I have not programmed anything in MatLab since forever, but i need this to work for a project I am doing. Best copy I have, evidently I deleted the working copy and for the life of me, I can't fix it. Any good people out there that can help edit this crazy thing back to health? See code below, relatively straightforward, but its not compiling...I dunno. My feeble attempts to fix it after all these years is...um... feeble... ;-) I barely remember how to load up a script, much less. BUT I gotta have it, any takers? Best Regards, Jeff ------------------------------------------------------------- %Read two image files A=imread('Bright1.png','png'); B=imread('Bright2.png','png'); A=rgb2gray(A); B=rgb2gray(B); [a1 b1]=size(A); [a2 b2]=size(B); count1=a1*b1; count2=a2*b2; count=min(count1,count2); C1=reshape(A1,1,count1); C2=reshape(A2,1,count2); %Create serial port objects to open the serial ports s1=serial('com6','baudrate',230400,'outputbuffersize',2*count); fopen(s1); s2=serial('com5','baudrate',230400,'inputbuffersize',2*count); fopen(s2); %Seri...

Contribute to MATLAB Central and Win a MATLAB Jacket
Many of you who post to this newsgroup are also regular contributors to the MATLAB Central File Exchange. Look for your favorite contributors on our File Exchange Author Profile page. You can read their profiles and see pictures: <http://www.mathworks.com/matlabcentral/reports/fileexchange/allProfiles/> In a random drawing, we recently awarded MATLAB jackets to three File Exchange authors with profile pages: Michele Giugliano, Andrey Egin, and Denis Gilbert. You can win a jacket, too. Just submit a new file to the File Exchange or update your author profile by December 2003 for a chance to win one of four MATLAB jackets. See the jacket below: <http://www.mathworks.com/matlabcentral/images/jeff3.jpg> Here are some interesting File Exchange facts: - Since its inception in 2001, visitors have downloaded more than 1.25 million submissions from the File Exchange. - In September 2003 alone, visitors downloaded 80,085 files, an average of 2670 a day! .... what if the prize was a free copy of the next version of Matlab :-) majb Min Poh wrote: ....or an offer for employment... aj "bourassa" <bourassa-m@rmc.ca> wrote in message news:3f9d507d\$1@rmcnt03a.rmc.ca... > ... what if the prize was a free copy of the next version of Matlab :-) > > majb > > Min Poh wrote: > ...

Matlab 2011: matlab coder (build failed)
When I create a MATLAB Coder Project and try to convert this function: ------------------------- function y = myResampler(x,m,n) %#codegen fsVec = [8000 16000 32000 48000]; targetFsVec = [8000 16000 32000 48000]; fs = fsVec(m); targetFs = targetFsVec(n); y = resample(x,targetFs,fs); ------------------------- to C-code I get a build error saying: coder -build resamplerproj.prj ??? The upsample factor P must be constant. Error in ==> myResampler Line: 12 Column: 5 Code generation failed: Open error report. But I want to be able to resample x using a variable P/Q ratio. Is this just a limitation of Matlab Coder or am I doing something wrong?? John wrote: > When I create a MATLAB Coder Project and try to convert this function: > > ------------------------- > function y = myResampler(x,m,n) %#codegen > > fsVec = [8000 16000 32000 48000]; > targetFsVec = [8000 16000 32000 48000]; > > fs = fsVec(m); > targetFs = targetFsVec(n); > > y = resample(x,targetFs,fs); > ------------------------- > > to C-code I get a build error saying: > > coder -build resamplerproj.prj ??? The upsample factor P must be > constant. Error in ==> myResampler Line: 12 Column: 5 Code generation > failed: Open error report. > > > > But I want to be able to resample x using a variable P/Q ratio. > > Is this just a limitation of Matlab Coder or am I doing something wrong?? Apparently it's a limitation of RESAMPLE ...

Help with Parallel Matlab
Long story short, here is the criteria I need. 1) I need two modules running in parallel. One function must activate these two They don't need to START at the same time but both neither return info nor end. They run pretty much infinitely 1.1) I would prefer if the One function also ran separate from the above two in it's own loop but i can deal with a 3'rd function also not ending. 2) I need a shared variable between two of the modules. 1 Module will place information there while the other just reads it, but as they are running parallel. That's it. I can do this in pretty much any other language but matlab I've been having issues with. Problem is I absolutely need to use matlab for one module. If this is impossible to accomplish all in matlab then can i instead run this in C and call one matlab module with separate thread? Sample code below. function mainParallelTest() persistent counter; counter = 0; parfor i=0:2 if (i == 0) ImageProccessorParallelTest(); elseif(i == 1) EventProcessorParallelTest(); elseif(i == 2) prevCounter = 0; tempCounter = 1; while(true) tempCounter = counter; if (tempCounter == prevCounter) %disp('hi') end prevCounter = tempCounter; end end end "Alex Cruikshank" <cruiksam@gmail.com> writes: > Long story short, here is the criteria I need. >...

Help with Matlab Problem

Is Matlab helpful to IT students ??
Is Matlab helpful to IT students ?? I am an IT student, can I develop in Matlab or is it only useful to students in Electronics ?? Or should I continue in C/C++/C# ?? On Apr 8, 3:23=A0pm, "Animesh Pandey" <apanimesh...@gmail.com> wrote: > Is Matlab helpful to IT students ?? > > I am an IT student, can I develop in Matlab or is it only useful to stude= nts in Electronics ?? > Or should I continue in C/C++/C# ?? As Winnie the Pooh said: Yes. Yes, knowing matlab is useful. Yes, you should continue with C/C++/C#. Matlab is a tool that allows ou to do a lot of stuff easily, if not always efficiently. The others are specialist's tools that allow you to do things very efficiently, if not always easily. Rune ...

Why does Matlab do this
What is happening when I type rand(1:10) at the command line? Matlab goes into a 10 minute spin - what's going on? Thanks "Robert" wrote in message <j64asi\$5v4\$1@newscl01ah.mathworks.com>... > What is happening when I type > rand(1:10) > at the command line? > > Matlab goes into a 10 minute spin - what's going on? > Thanks Hi Robert, You're create a 10-D array with that syntax. Do you just want a vector of 10 uniformly distributed random numbers. x = rand(10,1); % or x = rand(1,10); Wayne Hi Wayne, You're right - that's what I was trying to do... but I was just newbie mucking about trying to work out the syntax and I typed that in - then had a looong wait for Matlab to work through it! Thanks for the explanation. Robert "Robert" wrote in message <j64d2h\$dvo\$1@newscl01ah.mathworks.com>... > Hi Wayne, > You're right - that's what I was trying to do... but I was just newbie mucking about trying to work out the syntax and I typed that in - then had a looong wait for Matlab to work through it! > Thanks for the explanation. > Robert That's fine. Welcome to MATLAB!!! If that's the worst memory-intensive mistake you ever make, you'll be fine :) I've done much, much worse. Wayne ...

Web resources about - Maple To Matlab Help - comp.soft-sys.matlab

Undocumented Matlab
Undocumented, unsupported and hidden features in Matlab

Matlab Upazila - Wikipedia, the free encyclopedia
... 23°21′N 90°42.5′E ﻿ / ﻿ 23.35°N 90.7083°E ﻿ / 23.35; 90.7083 Coordinates : 23°21′N 90°42.5′E ﻿ / ﻿ 23.35°N 90.7083°E ﻿ / 23.35; 90.7083 Matlab ...

Open Directory - Science: Math: Software: MATLAB
The MathWorks - Developers of MATLAB, Simulink and Stateflow. Offers products for data analysis, visualization, application development, simulation, ...

MATLAB Mobile on the App Store

In the aftermath of an earthquake, every second counts for disaster victims. Imagine a system that can locate people quickly and help first responders ...

The A-Z of Programming Languages: MATLAB
What prompted the development of MATLAB?

Matlab: Invalid .NET Framework. Either the specified framework was not found or is not currently supported ...
If you are trying to compile Matlab into .Net framework, you might encounter this message, even though you have the .Net framework installed ...

Matlab edges closer to electronic design automation world
Matlab, one of the world's most widely used products for algorithmic development, has long occupied its own niche far removed from EDA and hardware ...

Can I/How do I use DMTCP with a parallel pool of MATLAB workers? · Issue #223 · dmtcp/dmtcp · GitHub
dmtcp - DMTCP: Distributed MultiThreaded CheckPointing matlab -nodisplay -r "parpool('local',4); parfor i=1:10, pause(1); fprintf('%i ',i); end; ...

Using MATLAB and SDR to Reverse Engineer 433MHz Messages
... so he focused on studying the methodology and the tools available for analyzing 433MHz RF transmission. He describes the process of using MATLAB ...

Resources last updated: 3/30/2016 8:49:45 PM