Question

How to increase contrast of a 3d plot? Should I set colorbar to log scale?

Hi all, I have the following code to plot a structure with y-displacement as ColorMapData ('node.mat', 'elem.mat', 'phiOri.ma...

mehr als 2 Jahre ago | 1 answer | 0

Question

How to understand pdeplot3D?

Hi all, I'm trying to run this example from help of function pdeplot3D: structuralmodel = createpde('structura...

mehr als 2 Jahre ago | 1 answer | 0

Question

Sort cells order according to their values?

Hi all, I have a function produces a cell like this: K>> otpt{:} ans = 3 0 2 1 ans = ...

mehr als 2 Jahre ago | 1 answer | 0

Question

Logscale x axis of stacked bar chart, how to make the chart shows clearer results?

Hi all, I have some data, and I'd like to plot them into horizontal bar charts with log scale on x-axis. I wrote some code li...

mehr als 2 Jahre ago | 0 answers | 0

Question

L2 norm or Frobenius norm?

Hi all, I read that Matlab norm(x, 2) gives the 2-norm of matrix x, is this the L2 norm of x? Some people say L2 norm is squa...

mehr als 2 Jahre ago | 2 answers | 0

Question

Measure performance of 2 programmes

Hello, I have 2 codes codeOld and codeNew, each contains many methods (i.e. both very complex). I'd like to prove that codeNe...

mehr als 2 Jahre ago | 1 answer | 0

Question

Add elements of array A to array B and ensure there is no repeated element in B?

Hi all, If I have arrays A and B, and I'd like to add elements of array A into array B, during this process, B is actively ch...

fast 3 Jahre ago | 2 answers | 0

Question

Can I recover only the diagonal elements of A' * B with SVD vectors of A and B?

Hi all, Imagine I have 2 matrices A and B and I need the diagonal elements of (A' * B). If say A and B are both m*n matrices ...

fast 3 Jahre ago | 1 answer | 0

Question

How to calculate trace(A' * B) using SVD vectors of A and B?

Hi all, Imagine I have 2 large matrices which have more rows than columns, I'd like to calculate trace(A' * B) for N times. I...

fast 3 Jahre ago | 2 answers | 0

Question

How to plot a mesh with colors like contour?

Hi all, I have a mesh information including deformation, nodes and connectivity. Now I'd like to visualize it with a coloured...

fast 3 Jahre ago | 1 answer | 0

Question

Which one is faster: trace(a' * b) or sum(sum(a .* b', 2))?

Hi all, If I have 2 matrices with same size, I first perform SVD to each, then calculate the trace differently as follows: ...

fast 3 Jahre ago | 2 answers | 0

Question

How to improve the speed of computing trace in my code?

Hi all, In my code there is a key function which cost the majority of computational power due to the large number of repetiti...

fast 3 Jahre ago | 1 answer | 0

Question

Use logical values to extract a matrix not a vector?

Hi all, I have a matrix like this: M = 6 2 9 7 2 3 9 3 ...

fast 3 Jahre ago | 3 answers | 0

Question

How to find the indices within blocks and sort the blocks thereafter?

Hi all, Say I have the following matrix contains 15 elements: M = 6 2 9 7 ...

fast 3 Jahre ago | 1 answer | 0

Question

Operations between every 2 different elements in a cell?

Hi all, I have a cell like this: K>> ur ur = 4×3 cell array {[1]} {'-1 -1'} {1×201 cell...

fast 3 Jahre ago | 1 answer | 0

Question

How to set the xy blocks in SURF plot as squares?

Hi all, I have a set of x,y,z data as follows: x = 0.1 0.31623 1 3.1623 10 y = -1 -0...

fast 3 Jahre ago | 1 answer | 0

Question

Problem with XTick: location of XTick doesn't match data.

Hi all, I have the following script to plot 2 curves with 2 x-axis on top and bottom: clear; clc; clf; errxOri = [4 6...

fast 3 Jahre ago | 1 answer | 0

Question

For 2 curves, how to have xticks on both the above and below of x-axis?

Hi all, I plot the attached figure using this code clear; clc; x1 = [1 3 5 7]; x2 = [1 2 4 7]; data1 = [...

fast 3 Jahre ago | 2 answers | 0

Question

Determine if a value has changed after some operations?

Hi all, How can I determine if a value has changed or not after some operations? For example: testA = valueA; % aft...

etwa 3 Jahre ago | 1 answer | 0

Question

Is it necessary to store column vectors in a column order in cells?

Hi all, I know MATLAB stores data in a column-major order (see <https://uk.mathworks.com/help/matlab/matlab_external/matlab-d...

etwa 3 Jahre ago | 0 answers | 0

Question

How to view the command window history?

Hi all, If there is a long command being executed and result being displayed, MATLAB does not show the full history in the c...

etwa 3 Jahre ago | 0 answers | 0

Question

How to improve speed of calculating trace in a script?

Hi all, In my project I have to calculate the trace of some matrix products, I have the following script to demonstrate the p...

etwa 3 Jahre ago | 1 answer | 0

Question

Compare and find multiple matching strings

Hi all, I have a text file (.inp) from Abaqus, where I need to find the line number of some strings. I read the file using 'f...

etwa 3 Jahre ago | 2 answers | 0

Question

What's the best way to add semi-colons after each element of a matrix?

Hi all, I have a cell matrix which contains strings like this (showing part of the cell, actual cell can be quite large): ...

etwa 3 Jahre ago | 1 answer | 0

Question

How to define the output path of THE "system" command

Hi all, I use Matlab script to call Abaqus. The command I use is: system('/home/xiaohan/abaqus/6.14-1/code/bin/abq6141 n...

etwa 3 Jahre ago | 0 answers | 0

Answered

Write multi-line strings into text file?

found an answer here: <https://uk.mathworks.com/matlabcentral/answers/195207-saving-cell-array-and-string-to-text-file> co...

Write multi-line strings into text file?

found an answer here: <https://uk.mathworks.com/matlabcentral/answers/195207-saving-cell-array-and-string-to-text-file> co...

etwa 3 Jahre ago | 0

| accepted

Question

Write multi-line strings into text file?

Hi all, I have a few lines of strings, which I'd like to write into a .inp (basically a text) file. The strings look like thi...

etwa 3 Jahre ago | 3 answers | 1

Question

Str2num: exact the same conversion

Hi all, Quick question: I have a string like this: rawStrMod = '0.0000000001, 0.3' I use str2num to convert it to nu...

etwa 3 Jahre ago | 1 answer | 0

Question

Difference between these 2 operations: D = M' * M then P' * D * P and P' * (M' * M) * P.

Hi all, Imagine I have M = rand(N, N); P = rand(N, 3); where N is a VERY large scalar, then for these 2 functions:...

etwa 3 Jahre ago | 1 answer | 0

Question

Figure legend: how to prevent entries from showing?

Hi all, My code plots a figure with a few curves, after the code finishes running, I manually add the legend like this: ...

etwa 3 Jahre ago | 2 answers | 0