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.

Re: MATLAB program unresponsive to user inputs
On 12/02/2016 1:04 PM, Tanzila Khan wrote:
...

> Now, I have eight vehicle types. Out of these, for two of the vehicle
> types, whenever I want to include syntax for those two vehicle types,
> the code actually becomes unresponsive to the code. That is the inputs
> of vehicle type and age distribution seem like a default memory of the
> program, it still takes the user input, but doesn't use that input. The
> program just shows output using the same old data, the input it shows is
> also the same old data although a different set of vehicle type and age
> files were selected. When I delete all syntax, and connections related
> to these two vehicle types from the main program, everything becomes
> alright. I can run for any other vehicle types and age files.
> I don't know if I am using the correct term for this, but it seems to me
> like the program is somehow "corrupted" for these two vehicle types. I
> think I should state that initially, everything was okay, but I ran my
> program several times for these two vehicle types, and now I have this
> problem. Can anyone please please help me with this??
...

In detail, no, not really...you didn't supply either any code or data
but the general symptom sounds like one of many possibilities--

1) Perhaps you have unintentionally overwritten the data in the two
files with that from another or accidentally renamed the wrong files so
they reflect something different than their actual content.

2) Mayhaps the selection logic isn't working the way you intend and the
files are right but you're either not actually reading those files again
or reading a different set or not reading at all and are, in fact,
redisplaying previous results.

First, eliminate the first scenario by independently checking that the
input files are, indeed, named correctly and have not been corrupted or
modified. Once you've got them correct, ensure you do have inviolate
backup copies stashed away somewhere while you finish debugging your code.

Next, use the debugger to set breakpoint and walk through the code to
find where the logic doesn't actually work correctly...

Mysterious symptoms such as this are all too common in code development;
"stuff happens" in that the computer does _precisely_ what we tell it;
it doesn't have a "you know what I mean" instruction.
Re: PROBLEM IMPORT excel file .xlsx
On 12/02/2016 9:02 PM, Andrea Vatulas wrote:
> Hello,
>
> I'm trying to load a .xlsx file in matlab for statistical manipulations
> (mean, plotting, etc).
>
> When I use xlsread('filename.xlsx') it creates a 16x20 matrix (dimension
> of the file excel) but in several cells stange number appear (e.g.
> 1,8337e+03 instead of 1833,70). The strangest thing is that it is not
> consistent,

Well, it IS consistent; it's just consistent with a different set of
rules than you're thinking of... :)

 >> 1833.7
ans =

    1.8337e+03

 >> format shortg
 >> 1833.7
ans =
        1833.7
 >>

It's just a figment of the display output Matlab uses; by default it is

FORMAT SHORT

which is

  format SHORT Scaled fixed point format with 5 digits.

See

   doc format % for all options available at command line

or, of course, if you really, really _must_ see a particular format, you
can force display it however desired with the formatting strings and
SPRINTF and friends...

But, however the value is displayed, it's the same value in memory so
doesn't make any real difference except aesthetics.
How to save value of bounding box in matlab
I am making a program in which i draw a bounding box around human. how can i save value of bounding box in matrix or array using loop.
Simulation and the Monte Carlo Method, 3rd Edition

 

This accessible new edition explores the major topics in Monte Carlo simulation that have arisen over the past 30 years and presents a sound foundation for problem solving 

Simulation and the Monte Carlo Method, Third Editionreflects the latest developments in the field and presents a fully updated and comprehensive account of the state-of-the-art theory, methods and applications that have emerged in Monte Carlo simulation since the publication of



Read More...
Re: positive definite sparse matrix Cholesky rank 1 update
Karthik" <raoaroor@wisc.edu> wrote in message <o1t23n$du0$1@newscl01ah.mathworks.com>...

> The issue is that I want to solve this iteratively (about n iterations) and therefore it is slow.
> For each iteration, A and b change.

I'm confuse, do you want to solve 1 system using iterative method, or solving sequentially n systems Ai * x = bi, i, = 1,,,n, knowing that Ai+1 = Ai + D(pi) ?

You won't take advantage of the sparsity of A with brute direct method, since the it involved a dense factorization, and even a simple change of A requires a full update of factorization, with cost at least n^2 for each system.

You might look at iterative method (for each system), then start to solve the system i+1 from the solution xi, and use some sort of gradient/quasi-newton method.Note that Quasi-newton BFGS method is based on rank-1 approximation of the inverse of the Hessian, written in a economic form (sum of tensorial product). You might take your inspiration from that.
Re: Random function
Alan" wrote in message <hufbpv$ro$1@fred.mathworks.com>...
> Hi there,
> Anybody could give me a hand in the following problem! I would be greatly appreciated with it.
> Now I want to generate a sequence of random increasing number say Q(which I could implement it in Matlab). And I want to return a value bounded between [a,b] after a random transformation function of P(Q), in which P is an increasing function of Q. Can I literally actualize a random function in Matlab?
>
> Many thanks!
> try Q=sort(rand(1,100)); i cant guess the entire problem so this is as specific as i can get
Re: Multipath Rayleigh Fading channel in OFDM
Dear David

Hi ^^
I am studying OFDM in layleigh fading channel.
Could you provide your code for me??
I vet your code is very helpful for me to study :)
Thanks

Best regards,
Mason
Re: problem with variables imput in function
On 12/3/2016 12:21 AM, Aurelien PELISSIER wrote:
>
>> see
>> https://www.mathworks.com/help/matlab/ref/integral.html
>>
>> Look at the example with "Parameterized Function". On how
>> to pass extra parameter.


>
> however, I don't even want to do an integration, Im just
>trying to understand how this @ is working, in your example, they write @(x) instead of @
>
> and the following code isnt working because the function to integrate is a matlab function
> -----------------------------------------------------------------
> function main
> % Compute the area under the curve from 0 to pi.
> xmin = 0;
> xmax = pi;
> f = @(x)myIntegrand;
> a = integral(f,xmin,xmax)
>
> function y = myIntegrand(x)
> y = sin(x).^3;
> --------------------------------------------------------------------
>

In your code, you need to write

-------------------------------------
function main
% Compute the area under the curve from 0 to pi.
A = 2;
xmin = 0;
xmax = pi;
a=integral(@(x)myIntegrand(x,A),xmin,xmax)

function y = myIntegrand(x,A)
y = A.*sin(x).^3;
---------------------

main

a =
     2.6667

> If you want to know everything Im working with partial
>differential equation and im using the pdepe solver. And I have some problems with this @
>
> my question is : what does this @ exactly mean ?
>

@ is function handle.

https://www.mathworks.com/help/matlab/matlab_prog/creating-a-function-handle.html

--Nasser
PROBLEM IMPORT excel file .xlsx
Hello,

I'm trying to load a .xlsx file in matlab for statistical manipulations (mean, plotting, etc).

When I use xlsread('filename.xlsx') it creates a 16x20 matrix (dimension of the file excel) but in several cells stange number appear (e.g. 1,8337e+03 instead of 1833,70). The strangest thing is that it is not consistent,

Any tips?

Thanks in advice
Re: problem with variables imput in function
On 12/2/2016 8:05 PM, Aurelien PELISSIER wrote:
> Hi guys !
> My problem is very simple, here the following code is working and give me the value of the integral.
> ----------------------------------------
> function main
> % Compute the area under the curve from 0 to pi.
> xmin = 0;
> xmax = pi;
> f = @myIntegrand;
> a = integral(f,xmin,xmax)
>
> function y = myIntegrand(x)
> y = sin(x).^3;
> ------------------------------------------
>
>
> Now I would like to do the same by adding a parameter "A" like this
> --------------------------------
> function main
> % Compute the area under the curve from 0 to pi.
> A = 2;
> xmin = 0;
> xmax = pi;
> f = @myIntegrand(A);
> a = integral(f,xmin,xmax)
>
> function y = myIntegrand(x,A)
> y = A.*sin(x).^3;
> ----------------------------------
> it gives me the error : Unbalanced or unexpected parenthesis or bracket.
> on the line f = @myIntegrand(A);
>
> I understand that but how can i tell matlab to take the function myIntegrand with A = 2 ?
>


see
https://www.mathworks.com/help/matlab/ref/integral.html

Look at the example with "Parameterized Function". On how
to pass extra parameter.

ps. do you really to do numerical integration for
simple function?

--Nasser
Post Selected Items to:

Showing 10 items of 849

home  •   advertising  •   terms of service  •   privacy  •   about us  •   contact us  •   press release design by Popshop •   Official PR partner PRNews.io •   © 1999-2016 NewsKnowledge