Login
Password
Sources on this Page

> Headlines by Category

 Home / Science / Mathematics

You are using the plain HTML view, switch to advanced view for a more complete experience.

The Revolutionary Rocket That Could Shuttle Humans to Mars
A novel plasma engine could slash travel time to Mars — now approximately three years — to just 39 days.
DAE index problem with ODE15s
Hi all,

I am having some trouble getting ODE15 to run on a 10x10 system, continuing to receive the error "This DAE appears to be of index greater than 1." I do not think this is the case though. Internet research tells me that normally initial conditions are the problem, but I am defining my IC's for the 2 algebraic equations consistently and cannot seem to nail down the problem.

The system mass matrix is:

1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0
0 0 -1 0 0 0 1 0 0 0
0 -1 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 1

The right hand side is:

[a(x)
b(x) - y2(x)
c(x) - y3(x)
d(x)
e(x)
f(x)
0
y7(x)
0
y9(x)],

Where a(x), b(x), etc. are all defined functions of x.

Any help would be greatly appreciated. Thank you!!

-Matt
Re: loop for several files using one function
On 4/18/2014 5:45 PM, fmri wrote:
> Hello,
>
> I have a function that I would like to run it on different files.

I can't follow you exactly. But the points seems to be that
you are looking for a way to know which output corresponds
to which input image?

If this is the the problem, then why not attach the input
image file name to each of the outputs.

So you'll end up with

image1_output1
image1_output2
image1_output3

image2_output1
image2_output2
image2_output3

image3_output1
image3_output2
image3_output3

etc... all in same folder.

To build the file name string, you can use sprintf().
Many examples exist how to do this.

--Nasser
EnsembleControlMassSpring.zip

This is a simple example of ensemble control on a mass-spring model. Several masses are attached to springs, and the other end of the springs are attached to a linear motor. The parameters of the mass-spring model are bounded but unknown. The position and the speed of the masses are used as states of the model. In this example, the position and the speed of the different mass-spring systems will be steered from the same initial state to the same desired final state with a certain degree of accuracy, dependent on the order of ensemble control. To do this, a discrete-time input is precalculated, which is then used to simulate the models using Simulink. The mathematics of ensemble control are explained in the workshop below:
http://telerobot.cs.tamu.edu/UiA2011/slides/BretlICRA-Workshop/BretlICRA-Workshop.pdf

Dynamics of Some Classical System Models

The animated response of several classical system models is presented. Examples include a) large amplitude pendulum motion b) falling elastic cable c) forced response of a spring-mass-damper system d) vibrating string either released with initial deflection, or shaken at one end, or subjected to a moving load e) beam released with initial deflection f) vibration modes for an elliptic membrane and for a pin-connected truss g) forced wave propagation in rectangular or circular membranes. The analyses employ Runge-Kutta integration, Fourier expansions, and algebraic eigenvalue calculations presented in the book Advanced Mathematics and Mechanics Applications Using MATLAB, 3rd Ed., by Howard Wilson, Louis Turcotte, and David Halpern, CRC Press, 2003.
To see how to run the program, use the command 'type contents' in the workspace containing the program.

Automotive Electrical System Simulation and Control

This model shows an example of a conventional vehicle electrical system model, which was shown in the webinar "Optimizing Vehicle Electrical Design through System-Level Simulation". The model is intended to study component sizing, selection, and control.
  http://www.mathworks.com/videos/optimizing-vehicle-electrical-design-through-system-level-simulation-81919.html

The electrical system model contains a Simscape lead-acid battery model as described in SAE Paper 2007-01-0778. There are two choices for battery size.

  http://www.mathworks.com/tagteam/40542_SAE-2007-01-0778-Battery-Modeling-Process.pdf

The model also contains data-driven alternator model options using either look-up tables or Model-Based Calibration Toolbox blocks. The alternator model is described in SAE Paper 2007-01-3471.

Control may be added to monitor the system condition, and increase idle speed to compensate for bad conditions in the vehicle charging system.

Vehicle loads are modeled as variable resistive elements.

----------------------------------------------------------------------------

Simulink Design Optimization can be used to estimate battery parameters from experimental battery data. To see how, please watch this video (5 min):
http://www.mathworks.com/videos/estimating-parameters-of-a-battery-68957.html

Parameter estimation for these models from measured data sets at different temperature and current data is a complex task. To learn how MathWorks Consulting can teach you this technique, please contact us or see:

MathWorks Consulting: Battery Simulation and Controls
http://www.mathworks.com/services/consulting/proven-solutions/battery-simulation-and-controls.html

----------------------------------------------------------------------------

customGray

This UI allows you to explore different options for creating custom grayscale images, and to generate MATLAB code and export the results.

Results and code provide output of type double, regardless of input type. (This allows visualization of a wide dynamic range.)

customGray images can improve visualizations and facilitate image segmentation.

loop for several files using one function
Hello,

I have a function that I would like to run it on different files. Call this function 'func'.

I have 15 different files (images) that are called S1_I, S2_I, S3_I, S4_I....S15_I

Since the output of the function is more than one (five outputs), I have to save the images in different folders.

So the organisation of the folders is as follow:

S/S1/I
S/S2/I
S/S3/I
S/S4/I
S/S5/I
.
.
.
S/S15/I

I can run the function individually for each S. Would it be possible to create a loop that runs that function from the main folder 'S' to apply for all the I files?

Thank you

Aser A
Re: Depth problem

"Claudio " <claudioangione@libero.it> wrote in message
news:liroq4$59t$1@newscl01ah.mathworks.com...
> ImageAnalyst <imageanalyst@mailinator.com> wrote in message
> <86ba94ec-36e3-4747-92b7-1f3312daacbc@i18g2000vbx.googlegroups.com>...
>> On Apr 21, 9:46 pm, "Jonathan Currie" <jonathan.cur...@hotmail.com>
>> wrote:
>> > Did you ever manage to solve this problem? I have just encountered the
>> > same in R2011b... Real pain!
>> ---------------------------------------------------
>> The solution was to create intermediate variables from an interior
>> set. Count the number of left parentheses in the string. If it's
>> more than 32, start finding matching pairs of parentheses and making
>> them their own variable. It might be inconvenient but what other
>> option do you have?
>
> In 2014 this daft error is still there, we need to write a script to find
> a workaround...

WHY do you have a string with more than 32 nested sets of parentheses in it?
Are you trying to do this just to test the limits of MATLAB or do you have
an actual use case where you need to do this?

If the latter, such a string is likely to be EXTREMELY long, and
nigh-unreadable (and unmodifiable -- just figuring out which right
parenthesis matches which left parenthesis is likely to be difficult!) So I
can only assume you have some program that's autogenerating this string. In
that case, I suggest that writing a script (or having the program write a
script file) is not a "workaround" but is the more robust and maintainable
solution. It may also be a better performing solution, if the script file
can define certain quantities (that are used often) as variables that are
then reused where necessary rather than recalculated each time they're used.

For example, if you're converting a symbolic expression (from Symbolic Math
Toolbox) into a string using something like char(symbolicExpression),
consider using matlabFunction instead. It can directly generate a function
file for you from a symbolic expression.

http://www.mathworks.com/help/symbolic/matlabfunction.html

If matlabFunction sees that the expression uses (x+y) in a number of places,
for instance, I think it may be able to define "temp1 = x+y;" and then use
temp1 where appropriate instead of performing the addition each time.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com
3D surface - minimum distance
Hello,

I am beginner in Matlab but anyway I would like to make my code more efficient. Would you have any ideas how I can verctorize two loops (or at least one) in the program below?
This program is just an example. The contours I am really dealing with are represented by 5000 and to 8000 points which makes program very slow.
Thank you for all your suggestions.

Cheers,
Pawel

%===============================
%Program finds the minimum distance from each point
%of contour b to contour a.
%===============================

Na=5; % number of points that create contour a
Nb=7; % number of points that create contour b

a = randi([1, 100], [Na, 3]);% columns 1 2 and 3 are the coordinates x, y and z respectively
b = randi([1, 100], [Nb, 3]);% columns 1 2 and 3 are the coordinates x, y and z respectively
 
z=zeros(length(a),3);
 
for r1=1:length(b); % next we do this for all rows (points) of b
for r2=1:length(a); % we subtract first row (point) of b from each row (point) of a

        z(r2,:)=b(r1,:)-a(r2,:);

end

distances=sqrt((z(:,1)).^2+(z(:,2)).^2+(z(:,3)).^2);
distance_min=min(distances)

end
Post Selected Items to:

Showing 10 items of about 1700

home  •   advertising  •   terms of service  •   privacy  •   about us  •   contact us design by Popshop •   © 1999-2014 NewsKnowledge