Tag Archives: matlab

Blas loading error in MATLAB, unable to find the specified module

Two methods can be used for personal test:
method 1
① delete my computer – properties – advanced system settings – environment variables – Blas_ VERSION ;
② right click matlab properties to set compatibility, Windows Vista (service Pack1)getenv('BLAS_VERSION')

Invalid path found

② Running in MATLAB

setenv('BLAS_VERSION','')

Note:
the second method is temporary, which needs to be set every time MATLAB is opened, otherwise an error will still be reported.

After matlab2017b is activated, open the error reporting license manager error – 8

When installing, I read the tutorial and said that after activation, I need to crack the dynamic library file under the “crack” folder“ libmwservices.dll ”Replace it with “r2015b/bin/win64” under the installation directory of MATLAB 2015b\ libmwservices.dll ”

But I don’t have it in my crack file libmwservices.dll File… It’s strange that I downloaded the crack file again, but it’s still the same… Maybe it’s a version problem
or not

Finally, a practical method is found in another blog https://blog.csdn.net/m0_ 37638031/article/details/78982498

This blog contains not only the installation package of MATLAB, but also detailed and practical tutorials, especially the last step after activation

The specific steps are as follows:

After activation, copy the netapi32.dll file under the crack file (path as follows: MATLAB r2017b win64 crack/r2017b/bin/win64/netapi32.dll) directly to the installed matlab file (path as follows: C:// program files/Matlab/r2017b/bin/win64).

And then it’s working.

Matlab prompt error

Enter the following code
(1)

a = [1 2;3 4];
a(6) = 7;

Prompt:
attempt to grow array along ambiguous dimension.
in Chinese:
attempt to grow large array along fuzzy dimension

The following codes are correct
(2)

a = [1 2;3 4];
a(5, 8) = 7;

Why is it that code (1) is wrong and code (2) is at a loss when it exceeds the predefined matrix size?

The cause of the problem is as indicated in the prompt

, the program cannot determine the dimension of the matrix.
What do you mean?
Although the code segment (2) exceeds the predefined matrix dimension: 2-by-2, it can determine the matrix dimension after an assignment (a (5, 8) = 7): 5-by-8.
The code segment (1) is a linear index -- 6, which is converted to a matrix subscript of 2-by-3 or 3-by-2??
The computer doesn't know, so it reports an error. " attempts to grow data along fuzzy dimensions ". This tip, feel very awkward, in fact, is very correct .

How to use matlab to solve equation

How to use matlab to solve equation

1. Preface

As one of the three major mathematical software, Matlab is the best in numerical calculation. Solving equations is the most basic and common problem in engineering study and engineering calculation. It is very important to master the method of solving equations with modern tools to improve our engineering literacy. Therefore, this paper will introduce the method of solving equations in MATLAB.

2. Usage

solving process

2.1 – indicated variables

Tell the computer the variables contained in the equation, including parameters and unknown variables. For example, the equation to be solved is: obviously, there are symbolic variables a, B, C and X in the equation, so the writing method of this step is:

syms a b c x  

 

2.2 specify equations, unknowns and constraints (not required)

If there is more than one equation,

eqns put it in [] and separate it with a comma. For example:
vars unknowns to be solved
Names value (not required) Names: “return conditions” returns the general solution with parameters. ” If ‘true’ is returned and ‘false’ is not, a special solution is given;
Name: ‘ignoreanalytical constraints’ is the simplest form of the solution given. ‘true ‘is yes and’ false ‘is no
Name:’ principalvalue ‘only gives one solution. False is to return all solutions, true is to return only one solution;
Name: ‘real’ only returns real solutions

2.3 obtain the solution of the equation

If there are multiple functions, the solution is stored as a structure.

 

3. Specific examples

3.1 = general solution of sin (x) = 1

 

Specific code:

syms x  [x,params,conds]=solve(sin(x)==1,’ReturnConditions’, true) 

 

result

solx =pi/2+2*pi*k  params =k  conds =in(k,’integer’)

 

It can be seen that the general solution of the equation is as follows:

 

3.2 solve the following equation:

code:

syms a b c y x [x,y]=solve([a*x^2+b*y+c==0,a*x+2*y==4],[x,y])

 

result:

x =  ((a*b)/4-(-(a*(- a*b^2+32*b +16*c))/16)^(1/2))/a  ((a*b)/4+(-(a*(- a*b^2+32*b +16*c))/16)^(1/2))/a   y =  (-(a*(- a*b^2+32*b +16*c))/16)^(1/2)/2-(a*b)/8+2  2-(-(a*(- a*b^2+32*b +16*c))/16)^(1/2)/2-(a*b)/8

 

Namely:

Solving equations and equations with MATLAB

1. Solve function

① Numerical solution of single equation

syms x;

x0 = double(solve(x +2 – exp(x),x));

Find the solution of X + 2 = exp (x), and the result is shown in double

In use, you can also write x + 2 = = exp (x), note that ‘= =’

In addition, if there are multiple solutions, the function returns only one solution

② Solving the equation with signed variables

syms x a b c;

x0 = solve(a*x^2+b*x+c,x);

Two solutions can be obtained

③ Solving equations

syms x y z;

e1 = 2*x – y +z;

e2 = x + y – 6;

e3 = z^2 +2*y;

[x0,y0,z0] = solve(e1,e2,e3,x,y,z);

double([x0,y0,z0])

Can return multiple solutions, note that can not directly solve double conversion

2. Vpasolve function

Only one solution can be returned to solve the equation in a certain range

syms x;

double(vpasolve(x +2 – exp(x),x,[-2,2]))

The solution near a point can also be obtained

double(vpasolve(x +2 – exp(x),x,1))

The premise is that this’ nearby point ‘cannot deviate too much from the solution

To find out all the solutions, we can first draw a graph and find out the approximate interval or adjacent points of each solution

The usage of several integer functions in MATLAB (fix, floor, ceil, round)

There are the following integer functions in Matlab: fix, floor, ceil, round, and their differences are as follows


Fix: round in the direction of 0

>>fix(2.8) = 2
>>fix(-2.8) = -2

Floor: round in the direction of negative infinity

>>floor(2.8) = 2
>>floor(-2.8) = -3

Ceil: round in the direction of positive infinity

>>ceil(2.8) = 3
>>ceil(-2.8) = -2

Round: round to the nearest integer

>>round(2.8) = 3
>>round(-2.8) = -3

Solutions to several VTK compilation errors (vtk5.8 + VS2010)

There are several common errors that can occur during the compilation of a VTK project. The solutions are as follows:
error 1:
fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403
cause:
The minimum version of the system set for version migration is too low
Visual C++ 2010 no longer supports targeting Windows 95, Windows 98, Windows ME, or Windows NT. If your WINVER or _WIN32_WINNT macros are assigned to one of these versions of Windows, you must modify the macros. When you upgrade a project that was created by using an earlier version of Visual C++, You may see compilation errors related to the WINVER or _WIN32_WINNT macros if they are assigned to a version of Windows that is no longer supported (From MSDN)
The immediate cause – there are three lines of code in atlcore.h:
#if _WIN32_WINNT < 0x0403
#error This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended.
#endif
> bbb>
All in VTK directory stdafx. H file reference to modify WINVER, http://msdn.microsoft.com/en-us/library/aa383745.aspx _WIN32_WINNT, _WIN32_WINDOWS and _WIN32_IE definition, for example: # define WINVER 0 x0501
 


error 2:
error C2371: ‘char16_t’ : redefinition
:
In VTK project files are generated in the process of choosing the Matlab support (tex-mex), and adopted the VS2010 and above programming environment (http://connect.microsoft.com/VisualStudio/feedback/details/498952/vs2010-iostream-is-incompatible-with-matlab-matrix-h) :
I looked at the source code for matrix.h < core/matlab/include/matrix.h>
It has a definition for char16_t
typedef char16_t char16_t;” . Also the C++ header “Microsoft Visual Studio 10.0\VC\ Include \ YVALS. H “Also defines the same identifier(CHAR16_T). Because of these two definitions we get the redefinition error when matrix iostream.h(it internally includes yvals.h) are included in some cpp file.
Declaration of char16_t in the yvals.h is newly introduced in dev10 and was not there in VS2008. Therefore you are getting this redefinition error now on VS 2010(Dev10).

> solution 1 (without follow-up test) : BBB>
//added by John for solving conflict with VS2010
#if (_MSC_VER) < 1600 //VS2010
# ifndef __STDC_UTF_16__
# ifndef CHAR16_T
# if defined(_WIN32) & & defined(_MSC_VER)
# define CHAR16_T wchar_t
# else
# define CHAR16_T UINT16_T
# endif
typedef CHAR16_T char16_t;
# endif
#endif
#else
#include < yvals.h>
#endif//VS2010
> solution 2 (without follow-up test) : BBB>
Rename all char16_t in matrix.h
 
error 3:
LNK4199: /DELAYLOAD:vtkIO.dll ignored; no imports found from vtkIO.dll
cause:
DelayLoad (selected from the in-depth analysis DelayLoad “http://blog.csdn.net/panda1987/article/details/5936770).
As we know, there are two basic methods of DLL loading: implicit loading and explicit loading. Implicit loading is the method introduced in the previous article, where the input table of a PE loads the DLL into the memory space before entering the entry function. Explicit loading uses methods like LoadLibrary and GetProAddress to load the DLL into the process space when needed. Both of these methods are the ones we use most often. So what is delay load?
A DLL designated as Delay Load will not actually load the process space until it is needed, which means that the DLL will not be loaded if no function located in the DLL is called. The loading process is done by LoadLibrary and GetProcAddress, which is, of course, transparent to the programmer.
What are the benefits of this?There is no doubt that the program starts faster, because many DLLs may not be used at startup. Even some DLLs may not be used in the entire life cycle, so with Delay Load, the DLL does not need any memory.
> bbb>
Because for dynamic libraries, the load information is still recorded in the corresponding lib file, so in the properties of the project Linker->; Input-> Additional Depandencies may also have #pragma comment(lib, “vtkio. lib”) at the beginning of the Cpp. If the file is not found by the compile prompt, it is also required in the Linder->; General-> Add the location of the file in the Additional Library Directory.
If someone is the difference between the Lib and Dll unclear, see: http://www.cppblog.com/amazon/archive/2011/01/01/95318.html

Reproduced in: https://www.cnblogs.com/johnzjq/archive/2011/12/14/2287823.html