Réponse apportée
How to avoid rounding error
Matlab is simply truncating the displayed value for ease of reading. format longG sqrt(10001) In both cases, the actual value...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
I keep getting this error...
In your workspace, does a already exist, or some other arduino object? if so, type clear a (or the other relevant object) in ...

plus de 3 ans il y a | 2

| A accepté

Réponse apportée
Graph gives warning : function behaves unexpectedly on array inputs. What does this mean?
You are using matrix (linear algebra) operators, which include * and ^. If you try to calculate the function directly, You get a...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
Creating a struct with means and standard deviations
It looks like you want an array of structs. Use strings or uint64 for the IDs S = struct('id',uint64(123456),'mean',rand(3),'st...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
How to make specific elements of a cell equal to zero?
If there's a single value in each cell, you could first convert to a matrix. A = num2cell(rand(3)) Amat = cell2mat(A); Amat...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
I want to draw a scatterplot but there's a problem about range of color
To specify a custom range, you can use a pre-defined RGB colormap (replace 6 with 101 or whatever is appropriate) c1 = parula(6...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
add Gaussian distributed noise
Use normrnd

plus de 3 ans il y a | 0

Réponse apportée
For loop error, not getting desired output
At the end of the inner for loop, you set all_correct(columns,1) = correct; Columns == 3 forever, and correct == 4 by that poi...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Swapping of data points
The hopping happens because the output of roots() isn't sorted in a way that is useful for this script. Further, when you use s...

plus de 3 ans il y a | 1

Réponse apportée
pdeplot3d "value of 'colormapdata' is invalid" or "Length of colormapdata vector must equal number of nodes."
I'm not familiar with this toolbox, but... You have a 3D model, but only 2D flux. [qx,qy,qz] = evaluateHeatFlux(thermalresults...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
How to sum two gaussian curve fits (cfit) ?
You could evaluate the fits and add them, though they would no longer be cfits. x = linspace(20,35); F1pts = feval(F1,x); F2p...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
how to work with text files?
fopen is for low-level file operations you may not need. Perhaps try data = importdata('stud_ex.txt') Which will give you a s...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
why is this Matlab Code faster than the C++ code below? I want to understand what Matlab internally does better and faster than C++
I see an efficiency in primes.counter = primes.counter - 1; Matlab uses LAPACK for matrix/vector operations, which I think sho...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
Changing numbers in dataset
For only five values, I think it's pretty efficient to do a direct replacement: ds_new = zeros(size(dataset)) ds_new(dataset =...

plus de 3 ans il y a | 1

Réponse apportée
Where is the error in my code?
The colon operator has a default spacing of 1. r = 0:0.07 gives: 0, % next value... 1 > 0.07 % so r = [0] Use an intermedi...

plus de 3 ans il y a | 0

Réponse apportée
Issues updating vector inside a for loop
When find doesn't find any values > 0.999, it returns an empty vector, with a size of 0x1. Furthermore, max returns an empty vec...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Increasing Edge Lines in a Surface Plot
sf = fit([x,u],z,'poly15','normalize','on'); xpts = linspace(min(x),max(x),100); upts = linspace(min(u),max(u),100); [xx, uu]...

plus de 3 ans il y a | 0

| A accepté

Question


Is there a good reason for choosing assert() over an if condition with an error?
I want to make sure a condition is valid, so I write a quick test for it with a boolean output. Does it matter whether I put the...

plus de 3 ans il y a | 3 réponses | 1

3

réponses

Réponse apportée
How to plot a .txt file when the data is in blocks and each data is separated by space
Wow, that is an inconvenient format. One option is to use the data import tool--right-click on the text file in matlab and "imp...

presque 4 ans il y a | 0

| A accepté

Réponse apportée
How to append an image to a plot curve
You should be able to use a tiled layout. circuit = imread(which('RC_Charge_Circuit_Voltage.png')); figure tiledlayout(2,1)...

presque 4 ans il y a | 1

| A accepté

Réponse apportée
Add row numbers to side of table in MATLAB
rownums = 1:size(T,1); T.Properties.RowNames = string(rownums);

presque 4 ans il y a | 1

| A accepté

Réponse apportée
Matching multiple file names
You'll have to fill in some of the blanks because I don't know how you're opening files, but to find the corresponding filenames...

presque 4 ans il y a | 0

| A accepté

Réponse apportée
Quaternions with symbolic elements
The error says it all. It looks like symbolic variables aren't supported for quaternions. You might try a third-party toolbox: ...

presque 4 ans il y a | 0

| A accepté

Réponse apportée
Why am I getting an error 'Execution of script cosamp as a function is not supported'
Using the function provided by @Elghandouri Mohammed and the original script, the error I get is: Error using _*_ Incorrect d...

environ 4 ans il y a | 0

Réponse apportée
Meshgrid or other structure?
Axis_A = (-96:8:96)/2; mgrid = Axis_A+Axis_A'; would give you that matrix. As would [x,y] = meshgrid(Axis_A); mgrid = x+y;

environ 4 ans il y a | 0

Réponse apportée
How do I convert tall array duration time vector to HH:mm:ss for merging with tall array datetime vector ?
dates = tall(repmat(datetime(date),3,1)) times = tall(repmat(duration(15,12,1,345,'Format','hh:mm:ss.SSS'),3,1)) times.Format ...

environ 4 ans il y a | 0

| A accepté

Réponse apportée
why the plot doesn't work ,in the code i'm finding the estimation value of the phase using montecarlo simulation
since length(SNR) is 1, you are running one loop iteration and generating one point. plot() doesn't show one point unless you sp...

environ 4 ans il y a | 0

Réponse apportée
Graphical Draw Path Segments
Perhaps a "bezier toolbox" with an interactive mode would be useful: https://www.mathworks.com/matlabcentral/fileexchange/69302...

environ 4 ans il y a | 0

| A accepté

Réponse apportée
How to produce results of script in table
Your variables are all updated in place, overwriting the previous state. You could make an array out of each variable, and upda...

environ 4 ans il y a | 0

| A accepté

Réponse apportée
Imresize3 not resizing in z direction?
The second method should work. Are you sure you used imresize3() and not imresize() for that? For the first method, input all t...

environ 4 ans il y a | 0

| A accepté

Charger plus