https://www.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — New Questions2020-01-18T07:43:41Ztag:www.mathworks.com,2005:Question/5008352020-01-18T05:13:40Z2020-01-18T07:43:41ZBetter way to pull out values from a structI have a matrix with a matrix CT of struct data called callsTable. I'm trying to pull out just one of the columns called Time and create a 1D vector using the following code. Is there a better way that I can do this? Currently, running the code I get the following error message.
Unable to perform assignment because the size of the left side is 28-by-1 and the size of the right side is
6-by-1.
for k=1:size(CT,1)
for i=size(CT(k),1)
T(:,i)=CT(k).callsTable.Time
end
endSam Litvinhttps://www.mathworks.com/matlabcentral/profile/authors/1413666-sam-litvintag:www.mathworks.com,2005:Question/5008332020-01-18T05:02:37Z2020-01-18T07:38:08Zexpression is too large, symengine can't calculateI use symbolic expression to calculate sensitivity equasions of ODEs with 19 ODEs and 42 variables. And the error message is "the expression is too large , symengin can't calculate " when using it to calculate the second order sensitivity equations. I checked the dimension is more than 3 ten thousand and it isn't the sparse matrix. I debug into the symbolic there is no sourcecode, how do I do next?
Part codes like next:
function obj = compute_2nd_order_sensitivity_equations(obj)
M = obj.M;
N = obj.N;
if isempty(obj.S) || isempty(obj.dS) || isempty(obj.S0)
obj = obj.compute_1st_order_sensitivity_equations;
end
[SS,dSS,SS0] = sensitivity_equations_another([obj.x;obj.S(:)], obj.theta, [obj.dx;obj.dS(:)], [obj.x0;obj.S0(:)]);
SS(1:M,:)=[]; dSS(1:M,:)=[]; SS0(1:M,:)=[]; % remove the first order sensitivity equations
obj.SS = reshape(SS,M,N,N) ; % reshape the 2nd order equations
obj.dSS = reshape(dSS,M,N,N);
obj.SS0 = reshape(SS0,M,N,N);
obj.ODE_2nd_order_sensitivity_rhs = matlabFunction(obj.dx,obj.dS(:),obj.dSS(:),'vars', {'t', obj.x,obj.S(:),obj.SS(:), obj.theta}); % define the right hand side of the ODE as a function of time, system states + sensitivity, and parameter
obj.ODE_2nd_order_sensitivity_init = matlabFunction(obj.x0,obj.S0(:),obj.SS0(:),'vars', {obj.theta}); % define the initial condition as a function of parameters
end
symengine give error messages in function of matlabFunction
......
else
body = mup2matcell(funs, opts.Sparse);
body = renameInputs(body,vars,inputs);
g = symengine('makeFhandle',varnames,body);
end
Wang Honghttps://www.mathworks.com/matlabcentral/profile/authors/3211426-wang-hongtag:www.mathworks.com,2005:Question/5008002020-01-17T19:54:13Z2020-01-18T07:34:28Zthis code is taking a lot of time to run, Is there anyway i can write this code efficiently and reduce runtime? I am trying to import data from multiple files in a folder
clc;clear;
testfiledir = 'C:\Users\bidgu\OneDrive\Desktop\manpower';
matfiles = dir(fullfile(testfiledir, '*.xlsm'));
nfiles = length(matfiles);
datafi = cell(nfiles);
for i = 1 :nfiles
% fid = fopen( fullfile(testfiledir, matfiles(i).name) );
datafi{i} = readtable(fullfile(testfiledir, matfiles(i).name));
% fclose(fid);
endPrajwal Venkateshhttps://www.mathworks.com/matlabcentral/profile/authors/13333755-prajwal-venkateshtag:www.mathworks.com,2005:Question/143712011-08-23T14:33:56Z2020-01-18T07:14:03Zmatlab cannot save my figureDear all,
I am having a problem with Matlab and I don't know how to solve it, I tried to search for the error and I couldn't find any solution, can you help me please ?
I am getting the following message when I try to save a huge image 5003 x 49597, using Pcolor, and it is not saving my image.
matlab warning: Variable 'hgS_070000' cannot be saved to a MAT-file whose version is older than 7.3. To save this variable, use the -v7.3 switch.
Skipping...
> In hgsave at 268
In general\private\saveasfig at 7
In saveas at 126
In loading_whole_summer2009 at 24 (this is the function name I have created)
I am using a desktop with a 16GB of RAM and 1TB of hard disk, and I am running only Matlab. Is there a way to optimize the memory or can you explain to me what does it mean the 'use the -v7.3 switch.'
thanking you in advance,LE FOUhttps://www.mathworks.com/matlabcentral/profile/authors/2474320-le-foutag:www.mathworks.com,2005:Question/5008252020-01-18T00:12:32Z2020-01-18T07:09:42Zhow to obtain volume data from X,Y,Z,c data to use slice() function?If we have X,Y,Z,v data, how can I manage to get Volume data form in order to use slice function?
please check data (data.mat)
first column: x coordinate
second column: y coordinate
third column: z coordinate
fourth column: dataPhilippe Cornerhttps://www.mathworks.com/matlabcentral/profile/authors/7103813-philippe-cornertag:www.mathworks.com,2005:Question/5008102020-01-17T21:52:01Z2020-01-18T06:37:54ZHow to read a binary file with below description?Each of our tumor segmentation files is a binary file, consisting of the following format:
1. six uint16 values for the inclusive coordinates of the lesion’s cuboid , relative to the image:
y_start y_end
x_start x_end
z_start z_end
2. the N int8 on/off voxels (0 or 1) for the above specified cube, where
N = (y_end-y_start +1) * (x_end - x_start + 1) * (z_end - z_start + 1).
A voxel value of 1 denotes that it is part of the lesion, while a value of zero denotes it is not.
update: I attached the files so if some one wants to test
salman rezaiehttps://www.mathworks.com/matlabcentral/profile/authors/9896934-salman-rezaietag:www.mathworks.com,2005:Question/5008412020-01-18T06:30:12Z2020-01-18T06:31:51Zhow to do element by element subtraction of two images?I want to do element by element subtraction of two images containing cars and road so that the cars get separated from the road. I already tried imabsdiff function but it does not give proper results. Can anyone tell me how to do it ?? Both the images are attached.Hamza Ashrafhttps://www.mathworks.com/matlabcentral/profile/authors/14338989-hamza-ashraftag:www.mathworks.com,2005:Question/1757052015-01-07T05:00:00Z2020-01-18T06:15:24ZWhy do I get an extract error while installing MATLAB?When running the MATLAB installer, I get an extract error that says the system cannot find the path specified.
Why do I get this error, and how can I resolve the issue?
Extract Error
MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:www.mathworks.com,2005:Question/5008392020-01-18T06:09:19Z2020-01-18T06:09:19ZUnit of worldpoints returned by triangulate functionhttps://www.mathworks.com/help/vision/ref/triangulate.html
What is the unit of worldpoints returned by triangulate function? (e.g. meters, mm etc).Swapnil Sayan Sahahttps://www.mathworks.com/matlabcentral/profile/authors/16736485-swapnil-sayan-sahatag:www.mathworks.com,2005:Question/5006352020-01-16T16:47:38Z2020-01-18T05:53:23ZConcerning some error For Loop in my optimal control problemThere's error ezplot(sol_a.x1,[0 1]) in my code below for solving a special optimal control problem
% State equations
syms x1 x2 p1 p2 u;
for i=0:0.1:1
Dx1 = -2*x2+u;
Dx2 = 2*x1;
% Cost function inside the integral
syms g;
g = u^2;
% Hamiltonian
syms p1 p2 H;
H = g + p1*Dx1 + p2*Dx2;
% Costate equations
Dp1 = -diff(H,x1);
Dp2 = -diff(H,x2);
% solve for control u
du = diff(H,u);
sol_u = solve(du, 'u');
% Substitute u to state equations
Dx1 = subs(Dx1, u, sol_u);
% convert symbolic objects to strings for using 'dsolve'
eq1 = strcat('Dx1=',char(Dx1));
eq2 = strcat('Dx2=',char(Dx2));
eq3 = strcat('Dp1=',char(Dp1));
eq4 = strcat('Dp2=',char(Dp2));
sol_h = dsolve(eq1,eq2,eq3,eq4);
%% use boundary conditions to determine the coefficients
conA1 = 'x1(0) = 3-i';
conA2 = 'x2(0) = 3-i';
conA3 = 'x1(1) = 0.5-(0.5)*i';
conA4 = 'x2(1) = 0.5-(0.5)*i';
sol_a = dsolve(eq1,eq2,eq3,eq4,conA1,conA2,conA3,conA4);
% plot solutions
figure(1);
ezplot(sol_a.x1,[0 1]);
axis([0 1 -4 3]);
hold on;
end
When I run the above code for every value i=0,0.1,...,1 separately, it works, but for "For Loop" it won't work. Mojtaba Moharerihttps://www.mathworks.com/matlabcentral/profile/authors/15237034-mojtaba-mohareritag:www.mathworks.com,2005:Question/5007962020-01-17T19:00:15Z2020-01-18T05:40:48Zsolving equation with if statementsHello
I am trying to solve the following equation given input time and values (y) vectors.
I tried the following
syms theta kappa alpha
if time < alpha
eqn = exp(-kappa*time)==y;
else
eqn = exp(-kappa)*exp(-theta*(time-alpha))==y;
end
vars = [theta kappa alpha];
S=solve(eqn);
but it raises an error...
Conversion to logical from sym is not possible.
I tried to convert alpha into double (i.e. double(alpha) ) in the if statement but it did not work...
Any suggestions?
the data look like :
antoinehttps://www.mathworks.com/matlabcentral/profile/authors/6475725-antoinetag:www.mathworks.com,2005:Question/4997642020-01-10T14:21:41Z2020-01-18T05:34:44ZWhat is the reason for this error?Error while building the model.
The call to stm32_make_rtw_hook, during the exit hook generated the following error: Can not create file : D:\workplace\FlowLED\.extSettings The build process will terminate as a result.
Caused by:
Can not create file : D:\workplace\FlowLED\.extSettings
Component:Simulink | Category:Block diagram error
Linqian Jinhttps://www.mathworks.com/matlabcentral/profile/authors/17192259-linqian-jintag:www.mathworks.com,2005:Question/5008372020-01-18T05:32:25Z2020-01-18T05:32:25ZHow to simultaneously publish the data to multi fields of thingspeak channel from a raspberry pi via code generation deployment using MATLAB code(not via Simulink) . The method to publish one field(field1) to think speak is given by the John Anderson
% raspberry pi object
r = raspi();
% log file
fid = fopen( 'logFile.log', 'w' );
% write random number to thingSpeak channel
v = rand;
commandStr = [ 'sudo curl -s "https://api.thingspeak.com/update.json?api_key=<your api key here>&field1=' sprintf( '%f', v ) '"' ];
result = system( r, commandStr );
% log command
fprintf( fid, '%s \n', commandStr );
% log result
fprintf( fid, '%s \n', result );
% close log
fclose( fid );
https://www.mathworks.com/matlabcentral/answers/467879-how-do-i-write-to-a-thingspeak-channel-from-a-raspberry-pi-via-code-deployed-using-the-matlab-coder
How to modify it to simultaneously publish the 2 data to 2 fields (field1 and field2) of thingspeak channel .prechanon kumkratughttps://www.mathworks.com/matlabcentral/profile/authors/11111738-prechanon-kumkratugtag:www.mathworks.com,2005:Question/5008362020-01-18T05:28:17Z2020-01-18T05:28:17Zwhat is the logic behind the hall effect sensors used in permanent magnet synchronous machine when we go through the look under mask ?Sandip Bhamarehttps://www.mathworks.com/matlabcentral/profile/authors/15484634-sandip-bhamaretag:www.mathworks.com,2005:Question/5006342020-01-16T16:37:31Z2020-01-18T05:18:01ZHow can I find the same value by using cellfun?condition = {EEG.epoch.eventtype};
%condition contains a lot of cell, and each cell have two values which either {11 1} or {12 2}.
correct_11trial = {'11' '1'};
correct_11 = cellfun(@(x) isequal(x,correct_11trial), condition(1,:));
%so I dfined the correct_11trial as {11 1}, and what I am looking for is to get the information that which
% cell is similar as correct_11trials in whole condition.
%However, the reuslt gave me all zero.
Can anyone help me to provide the instruction?
Thank you
Yu-Jung Tsaihttps://www.mathworks.com/matlabcentral/profile/authors/8046924-yu-jung-tsaitag:www.mathworks.com,2005:Question/5008342020-01-18T05:11:33Z2020-01-18T05:11:33ZHow to generate a symmetric Toeplitz matrix? How to generate a symmetric Toeplitz matrix in a specific range, say [-pi , pi]?Asma Ahmedhttps://www.mathworks.com/matlabcentral/profile/authors/5904670-asma-ahmedtag:www.mathworks.com,2005:Question/4771922019-08-22T11:58:03Z2020-01-18T04:54:37ZRun Simulink External mode using F28335 but Error The CH340 was used. The function of series communication is OK by checking. However, when I run the simulink with external mode, it occurs the errors below. It seems download is OK but external run is wrong? who can help me?
....
Build process completed successfully
Error occurred while executing External Mode MEX-file 'ext_comm':
Timed-out waiting for second connect response packet.
Component:Simulink | Category:Block diagram error
Unable to connect to the 'TI Delfino F2833x' target for 'c280x_2833x_gpio_wkey_ext1'.
Component:Simulink | Category:Model error
wu liaohttps://www.mathworks.com/matlabcentral/profile/authors/11130575-wu-liaotag:www.mathworks.com,2005:Question/5007862020-01-17T18:09:28Z2020-01-18T04:35:07ZHow to perform morphological reconstruction by dilation?I am performing retinal blood vessel segmentation and i need to perform morphological reconstruction by dilation.
I am implementing a paper titled " AUTOMATIC DETECTION OF MICROANEURYSMS AND HEMORRHAGES IN COLOR EYE FUNDUS IMAGES" by Sérgio Bortolin Júnior1 and Daniel Welfer2 .
I quote from paper," the detection of the blood vessels was performed from a morphological reconstruction by dilation, denoted by R. In this operation, we used a diamond-shaped structuring element with radius of 1 pixel."
In the below image, first image is f9 and the second image is f10 (the reconstructed output)
I am attaching an example of f9 as f9.jpg
Can somebody help me do this task?
Thank you.Krishna Chaitanyahttps://www.mathworks.com/matlabcentral/profile/authors/16691867-krishna-chaitanyatag:www.mathworks.com,2005:Question/5007932020-01-17T18:45:17Z2020-01-18T04:32:42ZHow to merge several 2D plots and make a single 3D plot if vector lengths are not same.I am trying to plot a 3D plot. for which I want to combine 20 2D plots(20 because I need >15 only for my work).
for 2D plots for these 20 different instances I have created two 20X5 matrix( tau and a ).where each row of tau contains value of X axis and each row of a contains particular Y axis value.
Now for 2D plots I can easily get plot by plot(tau(i,:),a(i,:)) ,where i can be anything between 1 to 20.but what to do if I want all these 2d plots arranged one by one from i=1 to 20. Plotting 3D as surface would be good.
I tried other commands given in other answers but I did not get my desired plot because in most of the cases commands require X,Y,Z to be vectors of same length. but in my problem vector lengths are not same.
please provide suggestions and command , how to solve this issue.ASHU DAYAL CHAURASIYAhttps://www.mathworks.com/matlabcentral/profile/authors/17307377-ashu-dayal-chaurasiyatag:www.mathworks.com,2005:Question/5008272020-01-18T00:19:15Z2020-01-18T03:54:24ZSelecting tables among 540 tables, based on a start and end dateHello all,
I have an x.mat cell which includes over 540 tables for 540 climate stations. In every 540 tables, there is a column named data (data is a wrong variable name for date). I want to have a code that selects every table that has a specific period from 1989 to 2018 and saves them in a new cell named x_selected.
I want to save the table if the start (1989) and end time (2018) are satisfied in the tables even if other years in between doesn't exist in it.
the following examples describe what I want:
for example, if one table (station) has only data from 2000 to 2018 so it is not going to save in x_selected because it hasn't data from 1989 to 2018. But if a table (station) has data for 1989 and 2018 (and not in between these two years) I want to save it in x_selected.
if a table has data for 2000 to 2003 I don't want it because the start time isn't 1989 and the end time isn't 2018.
if a table has data only for 2015 I don't want it because the time range 1989-2018 is not considered.
if a table has data from 1989 to 2018 but missed some years (like 2015, 2017) I want to save it because start time and end time are satisfied.
the above year is for example and may be different in the tables I just write them for example, what's important is start time (1989) and end time(2018).
x.mat is attached.
Thank you so much.Behzad Navidihttps://www.mathworks.com/matlabcentral/profile/authors/15525777-behzad-naviditag:www.mathworks.com,2005:Question/5008322020-01-18T03:53:34Z2020-01-18T03:53:34ZHow can I turn the following code to a surface plot function Visualize2(X, Y, E, F, k)
if k==4
k1=2; k2=2;
elseif k==2
k1=1; k2=2;
end
figure;
X=X'; Y=Y'; E=E'; F=F';
%Show the original manifolds
subplot(k1,k2,1);
plot3(X(:,1), X(:,2), X(:,3),'r-', 'LineWidth',.5);
hold on;
plot3(Y(:,1), Y(:,2), Y(:,3),'b-', 'LineWidth',.5);
title({['(A) Before Alignment']});
xlabel('X', 'FontSize',12, 'FontWeight', 'bold');
ylabel('Y', 'FontSize',12, 'FontWeight', 'bold');
zlabel('Z', 'FontSize',12, 'FontWeight', 'bold');
% 3D
subplot(k1,k2,4);
plot3(E(:,1), E(:,2), E(:,3),'r-', 'LineWidth',.5);
hold on;
plot3(F(:,1), F(:,2), F(:,3),'b-', 'LineWidth',.5);
title({['(B) After 3D Alignment']});
xlabel('X', 'FontSize',12, 'FontWeight', 'bold');
ylabel('Y', 'FontSize',12, 'FontWeight', 'bold');
zlabel('Z', 'FontSize',12, 'FontWeight', 'bold');
if k==4
% 2D
subplot(k1,k2,3);
plot(E(:,1), E(:,2), 'r-', 'LineWidth',.5);
hold on;
plot(F(:,1), F(:,2), 'b-', 'LineWidth',.5);
title({['(C) After 2D Alignment']});
xlabel('X', 'FontSize',12, 'FontWeight', 'bold');
ylabel('Y', 'FontSize',12, 'FontWeight', 'bold');
zlabel('Z', 'FontSize',12, 'FontWeight', 'bold');
% 1D
subplot(k1,k2,2);
plot(E(:,1), 'r-', 'LineWidth',.5);
hold on;
plot(F(:,1), 'b-', 'LineWidth',.5);
title({['(D) After 1D Alignment']});
xlabel('X', 'FontSize',12, 'FontWeight', 'bold');
ylabel('Y', 'FontSize',12, 'FontWeight', 'bold');
zlabel('Z', 'FontSize',12, 'FontWeight', 'bold');
end
end
Zain Khaliqhttps://www.mathworks.com/matlabcentral/profile/authors/9629946-zain-khaliqtag:www.mathworks.com,2005:Question/5003622020-01-15T06:57:40Z2020-01-18T03:06:21ZHow can I initialize nested handle class with independent valuesHello, my code is like this:
'ClassA.m'
classdef ClassA < handle
properties
t double = 0
end
end
'ClassB.m'
classdef ClassB < handle
properties
a ClassA = ClassA;
end
end
'TestFun.m'
clear all
test_num = 1e5;
tic
% initialization
class_b(test_num,1) = ClassB;
initialization_a = 0;
if initialization_a % loop assignment of element 'a'
for ii=1:test_num
class_b(ii).a = ClassA;
end
end
toc
% test if each b.a is independent, cause the default value of b.a.t is 0
class_b(1).a.t = 1;
disp(class_b(2).a.t)
Here is the problem description:
Array 'b' (type ClassB,length 1e5) has a member 'a' (type ClassA), they're both handle class.
when initialize 'b', each b.a shares the same value because 'a' is a handle class.
for some reason, i want each b.a have independent value, so i have 2 ways:
1st way is change the classA type as value class,
from "classdef ClassA < handle" to "classdef ClassA"
this will take about 0.15s;
2nd way is enabled loop assignment 'initialization_a = 1' in 'testfun.m'
this will take about 0.70s.
My question is, if i want to use handle class 'a'(2nd way), can i have a faster way to initialize 'a' and have independent b.a value,
the loop assignment seems to be too slow, especially when classA has more member variables.
Thanks a lot.pingping zhanghttps://www.mathworks.com/matlabcentral/profile/authors/15381093-pingping-zhangtag:www.mathworks.com,2005:Question/5007422020-01-17T13:37:14Z2020-01-18T03:02:34ZTransform raster image (points) to vector lineI have a raster image. In this image black points form a line.
Which matlab function help me to transform this points(raster) to line( vector)?
Unit point in line.
Thanks for answer! Iryna Goriainovahttps://www.mathworks.com/matlabcentral/profile/authors/17200692-iryna-goriainovatag:www.mathworks.com,2005:Question/5008232020-01-17T23:46:10Z2020-01-18T03:02:17ZHow to prevent addition from showing up in command windowI ran some code and am having trouble with the results of the code come out like this:
995
996
997
998
999
1000
How do I just get 1000 instead of all of the numbers? I have suppressed literally everything in the code.Kyle Donkhttps://www.mathworks.com/matlabcentral/profile/authors/17189528-kyle-donktag:www.mathworks.com,2005:Question/5008262020-01-18T00:18:22Z2020-01-18T02:51:55ZGet an image as an input from webcamI would like to get an image form webcam as an input an save it on a file. Also I would like to delete this image from the file when a new image has been taken by the webcam.(following image delete previous image).Mohammad Almekamihttps://www.mathworks.com/matlabcentral/profile/authors/16941696-mohammad-almekamitag:www.mathworks.com,2005:Question/4505112019-03-17T07:43:19Z2020-01-18T02:51:42ZMATLAB report generator table font familyHi, I am using MATLAB R2018b and I want to create a Table in MATLAB report generator and change the font style of its data.
I tried the following code but it does not work. Any ideas?
% import package
import mlreportgen.dom.*
% create the document object
doc_obj = Document('MATLAB_test_report','pdf');
% table
tableObj = Table ( {'a','b';'5','P'} ) ;
tableObj.Width = '30pt';
tableObj.Border = 'none';
tableObj.TableEntriesStyle = {Height('20pt'),FontFamily('Calibri')};
% append
append ( doc_obj , tableObj ) ;
% close document
close(doc_obj);
% display
rptview(doc_obj);Emmanouilhttps://www.mathworks.com/matlabcentral/profile/authors/3569931-emmanouiltag:www.mathworks.com,2005:Question/5008182020-01-17T22:56:19Z2020-01-18T02:27:07ZCalling a function from a scriptI'm trying to call a function from a script, but everything that I have seen and read on how to do so has not been helpful. Would someone please show me an example of calling a function from a script? I would really appreciate it.Kyle Donkhttps://www.mathworks.com/matlabcentral/profile/authors/17189528-kyle-donktag:www.mathworks.com,2005:Question/5002702020-01-14T16:35:13Z2020-01-18T02:21:37ZHi everybody, I need help in fixing my error for the matlab code% -d^2f(x)/dx^2 = 3+2*x^2;
clc;
clear all;
close all;
syms k(x) ;
k(x) = 3 +2*x^2; % known fn
nb = 4; % selection of heighest no of basis fn
%% Analytical solution
syms g(x)
eqn = -diff(g(x),2) == 3 +2*x^2; % diff eqn
cond = [g(0)==0, g(1)==0]; % boundary cond
a(x) = dsolve(eqn,cond); % diff soln
%% calculating z_matrix and v_vector
% Numerical solution %
for N = 2:nb
z = zeros(2,2);
v = zeros(1,2);
for n = 1:N
b(n) = (x-(x^(n+1))); % basis fn
w(n) = b(n); % galerkin's MOM
l(n) = -diff(b(n),x,2); % operator L
kr(n) = w(n).*k; % inner product
v(n) = int(kr(n),[0 1]); % v_vector using inner product b/w x->0 to 1
end
for i = 1:N
for j = 1:N
pr(i,j) = w(i).*l(j);
z(i,j) = int(pr(i,j),[0 1]); % z_matrix
end
end
%% LU_decomposition using gauss_elimination
zv = [z v'];
L = eye(N,N);
for i = 2:1:N
alpha(i,1) = zv(i,1)/zv(1,1);
L(i,1) = alpha(i,1); % L_matrix elements
zv(i,:) = zv(i,:)- (alpha(i,1)*zv(1,:)); % making zeros in col 1 using pivot 1
end
for r = 3:1:N
alpha(r,2) = zv(r,2)/zv(2,2);
L(r,2) = alpha(r,2);
zv(r,:) = zv(r,:)-(alpha(r,2)*zv(2,:)); % making zero in col 2 using pivot 2
end
U = zv(1:N,1:N);
%% using dummy variable_y finding_I
zb = [L v']; % Augmented matrix
y = zeros(N,1);
y(1) = zb(1,end)/zb(1,1);
for p = 2:1:N
y(p) = (zb(p,end)-(zb(p,1:p-1)*y(1:p-1)))/zb(p,p); % forward substitution
end
I = zeros(N,1);
I(N) = y(N)/U(N,N); % I_vector calculation
for q = N-1:-1:1
I(q) = (y(q)-(U(q,2:N)*I(2:N)))/U(q,q);
end
f(N) = b*I ; %finding f(x)
end
for h = 2:nb
figure(h)
d(x) = f(h);
x = 0:0.01:1;
plot(x,d(x),'b-','linewidth',2);
hold on
grid on
plot(x,a(x),'r-','linewidth',1);
xlabel('x')
ylabel('f(x)')
legend('Numerical method','Analytical method')
end
I have ' f ' as a vector of different functions and I want to plot is simultaneously in different figures but I'm not able to do it, error is showing ''Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variablesand function body must be sym expression''. But when I ommitting the loop in plot and by separate plotting I'm getting the plot for each h = 2/3/4. So please help me how to fix this problem.
Thank you for your help!sonu kumarhttps://www.mathworks.com/matlabcentral/profile/authors/16021251-sonu-kumartag:www.mathworks.com,2005:Question/5007552020-01-17T15:03:27Z2020-01-18T02:20:38ZSave Open State in Editor???Is there no preferences option to have editor reload previous state w/o having to open each and every file again? Very rude behavior...dpbhttps://www.mathworks.com/matlabcentral/profile/authors/28872-dpbtag:www.mathworks.com,2005:Question/5008282020-01-18T00:34:30Z2020-01-18T02:07:15ZEliminate tables with more than 15% NaN dataHey all,
I have C.mat which has 125 tables. I want to remove tables if any of tmax_m or tmin_m or rrr24 or tmin_m columns have more than 15% NaN cells.
C.mat is attached.
Thank you allBehzad Navidihttps://www.mathworks.com/matlabcentral/profile/authors/15525777-behzad-naviditag:www.mathworks.com,2005:Question/4767832019-08-20T04:25:08Z2020-01-18T02:05:52ZMatlab Ignoring Half of Equation When Solving ODE Hello,
I am trying to solve the Lorentz Force differential equation set in 3 space, however I am currently omitting the magnetic field entirely so ideally, the program would only look at the electric field. However, it is not and I know this because I have changed the electric field to be very different magnitudes while keeping the time step the same and the electron still travels the same distance when I look at the plot which it shouldn't. For some reason Matlab is completely ignoring the electric field entirely. Why is this the case? (All code displayed is also attached in seperate files)
PS - I have tried all the ODE solvers that I could and the same issue kept happening. I am also aware that in this specific case, the ODE solver is not exactly needed but it will be in the more complex version of the code
Main script:
%User inputs
%TSTEP MUST BE ABLE TO GO INTO TFIN AN ODD AMOUNT OF TIMES (Because simulation includes tstep @ 0 so it ends up being even)
tstep = 0.0625E-9; %Defining time step
tfin = 5.25E-8; %Defining final time
particlecount = 1;
%# of particles to generate energies for energy generation
s1 = 0.0200001; %Specify minimum radius particles may be generated
s2 = 0.0200002; %Specify maximum radius particles may be generated
phi1 = 90;
phi2 = -90;
%cs = 1.5E-20; %Cross-sectional area input in (m^2). (Held constant for sake of simplicity)
cs = 0;
energyaddition = 0; %Absolute value of the E-field strength of experiment in (eV)
inelasticenergyloss = 0; %Amount of energy an electron loses per collision in (eV)
scaleenergy = 0; %If need to scale all energies by a certain value (constant/unitless)
mTorr = 750; %Define pressure in mTorr (From metter reading)
ict = 290; %Temperature in Kelvin of neutral gas. Converted from C and @ room temp
%Natural Constants
m_e = 9.11E-31; %Mass of electron
jtoev = 6.24E+18; %Joules to eV conversion
epnaut = 8.854187E-12;
k = 1/(4*pi*epnaut);
%Create zeros matrices to populate later
energymat = zeros(1,1);
vmagmat = zeros(1,1);
intspan = [0:tstep:tfin]; %Total time span
intspancol = intspan(:); %inverts matrix's rows and columns
[introw,intcol] = size(intspancol);
icvelocity(1).matrix = zeros(1,3);
icposition(1).matrix = zeros(1,3);
%Convert additional energy to Joules
entrans = energyaddition*(1.6022E-19);
%Energy conversion to Joules for inelastic collisions
inelasticenergy = inelasticenergyloss*(1.6022E-19);
%Generates energy for particle
numin = 1E-19;
%Generate random positions for each particle between s1 and s2
%In Spherical: Generates random position with boundaries of: s1<r<s2
rrand = (s2 - s1)*rand() + s1; %Random # generation for component x between s1 and s2
thetarand = (2*pi)*rand(); %Random # generation for component y between s1 and s2
phirand = asin((sin(phi2rad) - sin(phi1rad))*rand() + sin(phi1rad)); %Random # generation for component z between s1 and s2
[xrand,yrand,zrand] = sph2cart(thetarand,phirand,rrand);
icposition = [xrand yrand zrand];
%Generates velocity components for each particle
vmagin = sqrt(2*energymat(1,1)/m_e);
vmagmat(1,1) = vmagin;
%vx = (icposition(1)/norm(icposition(1:3)))*vmagin;
%vy = (icposition(2)/norm(icposition(1:3)))*vmagin;
%vz = (icposition(3)/norm(icposition(1:3)))*vmagin;
vx = 1E+1;
vy = vx;
vz = vy;
icvelocity = [vx vy vz];
%Generate matrix that will be populated by positions and velocities (Each matrix within structure "Wposandvel" should be of size 2*introw-1 by 6)
Wposandvel = zeros(2*introw-1,6);
%This section is purely for generating matrices the program will populate later
tindex = 0:1:introw-2;
tindexcol = tindex(:); %inverts matrix's rows and columns
[tinrow,tincol] = size(tindex);
PCPmat = zeros(tincol,1); %Probability of collision solutions
choicemat = zeros(tincol,1); %Set of RNG choices system makes
colnewv = zeros(intcol,3); %New velocity components after collision
velocitytransitionmat = zeros(intcol,3);
energytransitionmat = zeros(intcol,1);
spart(1) = icposition(1,1);
spart(2) = icposition(1,2);
spart(3) = icposition(1,3);
vpart(1) = icvelocity(1,1);
vpart(2) = icvelocity(1,2);
vpart(3) = icvelocity(1,3);
for t = 0:1:introw-2 %complete time interval and time step
[trow,tcol] = size(t);
%Defining relative position and velocity
x = spart(1);
y = spart(2);
z = spart(3);
vx = vpart(1);
vy = vpart(2);
vz = vpart(3);
r = sqrt(x.^2 + y.^2 + z.^2);
vmag = sqrt(vx.^2 + vy.^2 + vz.^2);
vmagtimemat(1).matrix(t+1,1) = vmag; %Populate vmagtimemat structure
entrack = ((.5)*m_e*(vmag^2)); %Define energy at current time step
if r <= 0.02 %Defining particle collision with sphere surface. If collision occurs, vmag = 0
vx = 0;
vy = 0;
vz = 0;
break
end
%Coupled differential equation solver for trajectory within current time step
icv = [x; y; z; vx; vy; vz]; %Initial conditions
tspan = [intspan(t+1) ((intspan(t+2)-intspan(t+1))/2)+intspan(t+1) intspan(t+2)]; %Time span
%Trajectory solver
[T,S] = ode15s(@bdipuniodefun, tspan, icv);
[rownum,colnum] = size(S);
Wposandvel((1+2*t):(3+2*t),(1:6)) = S;
%Redfine the velocity and position components to reference on next if-loop run
spart(1) = Wposandvel((3+2*t),1);
spart(2) = Wposandvel((3+2*t),2);
spart(3) = Wposandvel((3+2*t),3);
vpart(1) = Wposandvel((3+2*t),4);
vpart(2) = Wposandvel((3+2*t),5);
vpart(3) = Wposandvel((3+2*t),6);
end
%Plotting Stuff
[X,Y,Z] = meshgrid(-0.1:0.005:0.1,-0.1:0.005:0.1,-0.1:0.005:0.1);
%{
%Plotting dipole B-field
[Bx, By, Bz] = B_test();
Bfieldx = arrayfun(Bx,X,Y,Z);
Bfieldy = arrayfun(By,X,Y,Z);
Bfieldz = arrayfun(Bz,X,Y,Z);
%}
%{
%Plotting Efield
[Ex, Ey, Ez] = E_test();
Efieldx = arrayfun(Ex,X,Y,Z);
Efieldy = arrayfun(Ey,X,Y,Z);
Efieldz = arrayfun(Ez,X,Y,Z);
%}
%{
%Plotting B-field by itself
figure
%subplot(3,3,2)
%Graph labels
axis equal
xlabel 'x in m'
ylabel 'y in m'
zlabel 'z in m'
title('B-Field')
%Changes figure background color
set(gca,'color','k');
quiver3(X,Y,Z,Bfieldx,Bfieldy,Bfieldz,'color','b') %Plots B-field
%}
%{
%Plotting E-field by itself
figure
%subplot(3,3,3)
%Graph labels
axis equal
xlabel 'x in m'
ylabel 'y in m'
zlabel 'z in m'
title('E-field')
%Changes figure background color
set(gca,'color','k');
quiver3(X,Y,Z,Efieldx,Efieldy,Efieldz,'color','g') %Plots E-field
%}
%Plotting trajectories only
figure
%Graph labels
axis equal
xlabel 'x in m'
ylabel 'y in m'
zlabel 'z in m'
title('Electron Trajectory Solutions')
%Changes figure background color
set(gca,'color','k');
hold on
Wposandvel(~any(Wposandvel(1:2*introw-1,1:6),2),:) = []; %Clears all rows in collpos that contain only zeros
plot3(Wposandvel(:,1),Wposandvel(:,2), Wposandvel(:,3), '-r', 'LineWidth',2,'color','w') %Plot trajectories
%Generate a sphere consisting of 20 by 20 faces
[x,y,z]=sphere;
% use surf function to plot
SSurface = surf(sphere1radius*x+sphere1centerx,sphere1radius*y+sphere1centery,sphere1radius*z+sphere1centerz);
set(SSurface,'FaceColor',[0.5 0.5 0.5],'FaceLighting','gouraud','EdgeColor','none')
camlight
scatter3(icposition(:,1),icposition(:,2),icposition(:,3),1,'filled','y') %Plot initial position points
hold off
view(90,90)
"bdipuniodefun" script:
function bdip = bdipuniodefun(t,s)
%Using SI units
q = -1.60217662E-19;
m_e = 9.11E-31;
persistent Bx By Bz Ex Ey Ez
if isempty(Bx)
[Bx, By, Bz] = B_test();
end
if isempty(Ex)
[Ex, Ey, Ez] = E_test();
end
%bdip = [s(4); s(5); s(6); (q/m_e)*(Ex(s(1),s(2),s(3)) + s(5)*Bz(s(1),s(2),s(3)) - s(6)*By(s(1),s(2),s(3))); (q/m_e)*(Ey(s(1),s(2),s(3)) + s(6)*Bx(s(1),s(2),s(3)) - s(4)*Bz(s(1),s(2),s(3))); (q/m_e)*(Ez(s(1),s(2),s(3)) + s(4)*By(s(1),s(2),s(3)) - s(5)*Bx(s(1),s(2),s(3)))];
bdip = [s(4); s(5); s(6); (q/m_e)*(Ex(s(1),s(2),s(3))); (q/m_e)*(Ey(s(1),s(2),s(3))); (q/m_e)*(Ez(s(1),s(2),s(3)))];
end
"E_test" script:
function [Ex, Ey, Ez] = E_test()
syms x y z
R_s = 0.02;
V = 2000;
epnaut = 8.854187E-12;
k = 1/(4*pi*epnaut);
Q = (V*R_s)/k;
r = [x, y, z];
E = (k*Q/norm(r)^3)*r;
Ex = matlabFunction(E(1));
Ey = matlabFunction(E(2));
Ez = matlabFunction(E(3));
end
Tom Keatonhttps://www.mathworks.com/matlabcentral/profile/authors/7591080-tom-keatontag:www.mathworks.com,2005:Question/5008062020-01-17T21:29:09Z2020-01-18T02:05:28ZHow can I use importONNXNetwork function on a production machine which only has MCR installedHi,
I want to use a pre-trained ONNX neural network on a production machine (PC) which only has MCR no Matlab. I tested my code in my development machine with MATLAB Version: 9.7.0.1190202 (R2019b), there was no problem. But once I complied it into a .net assembly and tried to use it on the production machine, it threw an error:
importONNXNetwork: importONNXNetwork requires the Deep Learning Toolbox Converter for ONNX Model Format support package. To install this support package, use the <a href="matlab: matlab.addons.supportpackage.internal.explorer.showSupportPackages('ONNXCONVERTER', 'tripwire')">Add-On Explorer</a>.
I think the problem is that the add-on "Deep Learning Toolbox Converter for ONNX Model" is not installed on the production machine. In contrast, my code can run without issue on my development machine because "Deep Learning Toolbox Converter for ONNX Model" is installed there.
How can I install the add-on "Deep Learning Toolbox Converter for ONNX Model" on the production machine with MCR? Or is there any other way to use a pre-trained ONNX or other types of neural network on a production machine (PC) which only has MCR no Matlab?
Thank you!CHANGYUAN LIUhttps://www.mathworks.com/matlabcentral/profile/authors/14918724-changyuan-liutag:www.mathworks.com,2005:Question/5008312020-01-18T02:05:06Z2020-01-18T02:05:06ZHow to set fine boundaries?I solve 2D heat equation.
I can create 4 edges like this figure.
ECCadynamics=createpde('thermal','transient');
e1 = [4;0;0;30;3;0]; % Outside ellipse
lbls = char('ellipse'); % Ellipse labels
lbls = lbls'; % Change to columns
sf = 'ellipse'; % Set formula
g = decsg(e1,sf,lbls); % Geometry now done
geometryFromEdges(ECCadynamics,g);
msh = generateMesh(ECCadynamics,'Hmax',1.5);
figure
pdeplot(ECCadynamics,'EdgeLabels','on');
axis equal
title 'Ellipse With Finite Element Mesh Displayed'
Then, I want to create 16 edges like this figure.What should I rewrite program?
Aimi Ogurihttps://www.mathworks.com/matlabcentral/profile/authors/12672747-aimi-oguritag:www.mathworks.com,2005:Question/5007842020-01-17T17:25:19Z2020-01-18T02:01:24ZSolving Symbolic Equations with Solve-Creating a GUII am creating a program (GUI) in Matlab and so in one part I need to solve a system of symbolic "n" equations (introduced by the user) unknowns. The code that I have generated works correctly, because I have checked the results, but these(the results) are shown in the form of a structure of symbolic elements and to be able to see each one, I need to write the name of the structure and the field and this is the PROBLEM! I have to make the results be shown and stored in an array or vector (because they are numbers) but with a for-cycle or any other, because I can't be writing 1 by 1 to see the results. Please if anyone can help me, I would appreciate it! Thank you.
Sistema_1=Ecuaciodiv_1a(2:filas,1)-Ecuaciodiv_2a(1:filas-1,1)
Sistema_2=Ecuaciodiv_1b(2:filas,1)-Ecuaciodiv_2b(1:filas-1,1)
for p=Puntos_Apoyo
Ecuaciones_3a=Ecuaciones_1b(p);
end
Sistema_3=Ecuaciones_3a
rptas=solve([Sistema_1,Sistema_2,Sistema_3])
rptas.c1
rptas.c2
rptas.c3
rptas.c4
rptas.c5
rptas.c6
rptas.c7
rptas.c8
rptas.c9
rptas.c10
rptas.c11
rptas.c12
rptas.c13
rptas.c14
rptas.c15
rptas.c16
rptas.c17
rptas.c18
Attached are some images.
Junior Aguilarhttps://www.mathworks.com/matlabcentral/profile/authors/15255403-junior-aguilartag:www.mathworks.com,2005:Question/5008302020-01-18T01:49:45Z2020-01-18T01:55:26ZHow to perform IndexingSuppose you wanted to apply the function built in problem 1 to large data sets for salary (All_E_Salaries) & performances (All_E_Performances). You have chosen to do this by calling that function iteratively inside of a for loop.
Modify the script below so that it will perform this iterative operation, and stores the values inside a new vector NewSalaries.
All_E_Salaries= [40000, 40000, 40000, 50000, 50000, 60000]
All_E_Performances = [4, 10, 5, 6, 3, 7]
for i=?? %% Complete this line by replacing the ??'s with the appropriate code.
[NewSalaries(??)] = BonusCalculator(All_E_Salaries(??) ,All_E_Performances(??)); %% Complete this line by replacing the ??'s with the appropriate code.
Larissa Aissata Diarrahttps://www.mathworks.com/matlabcentral/profile/authors/16098532-larissa-aissata-diarratag:www.mathworks.com,2005:Question/5007572020-01-17T15:14:54Z2020-01-18T01:33:14ZUsing complex structure in simulink constant blockHello,
I know that there is way to pass structure to simulink model as bus object but what should I do if i need to pass complex structure with structures as fields?
Example of structure:
Structure.A.a=1;
Structure.B.a=2;
Are there any another way to pass complex set of data to simulink model without accessing it to block parameters?Sergey Kasyanovhttps://www.mathworks.com/matlabcentral/profile/authors/7786299-sergey-kasyanovtag:www.mathworks.com,2005:Question/5006672020-01-16T22:44:25Z2020-01-18T01:22:00ZHow to pause signal at specific time for specific time?Hello,
I have made a simulation in Simulink representing integrated INS and GPS systems. I'd like to simulate loosing GPS signal for specific time at specific time of simulation? Which block (or set of blocks) should I use? I've thought about using a MATLAB function block and zeroing GPS signal when needed but zero signal is still a signal and I'd like it to not bring any signal at all.
Thanks in advance.Michal Suchonoshttps://www.mathworks.com/matlabcentral/profile/authors/15719599-michal-suchonostag:www.mathworks.com,2005:Question/5008292020-01-18T00:40:10Z2020-01-18T01:09:26ZSubplot, 1 large and 2 smallHello,
Is it possible to make a subplot that look like this:
What is code?
Sarah Yunhttps://www.mathworks.com/matlabcentral/profile/authors/16837202-sarah-yuntag:www.mathworks.com,2005:Question/5007982020-01-17T19:27:02Z2020-01-18T00:40:18Ztable less than operatorhi,
I'm having this error : Undefined operator '<' for input arguments of type 'table'.
how can I write the operator less than for table?
I ttied using gt(A,B) and lt(A,B) but it still give me this error.
I still want to use table and not to convert the table to array.
thanks!sanihttps://www.mathworks.com/matlabcentral/profile/authors/6350539-sanitag:www.mathworks.com,2005:Question/5008192020-01-17T23:13:55Z2020-01-18T00:39:22ZError using fprintf Unable to convert 'sym' value to 'double'.fprintf(nru,'{ %.3f uta1 + %.2f uta2 = -%.2f\n',[UI1,SG13,SG12]);
fprintf(nru,'{ %.3f uta1 + %.2f uta2 = -%.2f\n\n',[SG13,UI2,SG23]);
fprintf(nru,'uta 1 = %.4g\n\n',xSoa);
fprintf(nru,'uta 2 = %.4g\n\n',ySob);
fprintf(nru,'V3 = 1/(pierwiastek(1 + %.4s^2 + %.4s^2)) = %.4s\n\n',[xSoa,ySob,V31]);
fprintf(nru,'V1 = %.4g * %.4g = %.4g\n\n',[xSoa,V31,V11]);
fprintf(nru,'V2 = %.4g* %.4g = %.4g\n\n',[ySob,V31,V21]);
fprintf(nru,'VL1= [ %.4g ; %.4g ; %.4g ]',VL1);
When i use '%s'
In my txt, i dont have any numbers.
"Error using fprintf
Unable to convert 'sym' value to 'double'.
Error in WXY4 (line 281)
fprintf(nru,'uta 1 = %.4g\n\n',xSoa);"
Please help.Bernard Finikhttps://www.mathworks.com/matlabcentral/profile/authors/14590021-bernard-finiktag:www.mathworks.com,2005:Question/5008222020-01-17T23:45:12Z2020-01-18T00:33:23ZTrying too run two functions in parallel where the functions have two outputsSo I have two functions which I want to run in parallel and I want to store the two output values of each function in a cell. The problem I'm having is it only seems to be storing one of the outputs of each function and I dont know why.
funcs1 = {@linear_programming_bound, @linear_programming_bound};
arguments1 = {W,b,Xmins(:,j),Xmaxes(:,j);
W,b,Xmins(:,z),Xmaxes(:,z)};
solutions1 = cell(1,2);
M = 4;
parfor (ii = 1:2,M)
solutions1{ii}=funcs1{ii}(arguments1{ii,:});
end
M = solutions1{1}; N = solutions1{2};
P.S. Sorry, I know this same peice of code has been used in a fair few questions here. Luke Stalderhttps://www.mathworks.com/matlabcentral/profile/authors/11107558-luke-staldertag:www.mathworks.com,2005:Question/5008122020-01-17T22:00:33Z2020-01-18T00:33:08ZCode for D2D (device to device) usersI need a simple code for two D2D users. How they will send data to each other.Candy khanhttps://www.mathworks.com/matlabcentral/profile/authors/17297770-candy-khantag:www.mathworks.com,2005:Question/1339232014-06-12T14:02:46Z2020-01-18T00:33:01ZCheck Block Compatibiity Error<</matlabcentral/answers/uploaded_files/14049/kk.jpg>>
Hi guys.
I have error during using HDL Workflow Advisor. The error is _ _" Error: Product block with divide input (/) supports fixed point division only when the fraction length of output is equal to the fraction length of the dividend minus the fraction length of the divisor."_ _ . But, i dont understand what exactly the meaning is.
Does anyone know about this problem? How can I solve it? Thanks in advanceMaximumhttps://www.mathworks.com/matlabcentral/profile/authors/5217016-maximumtag:www.mathworks.com,2005:Question/5005722020-01-16T11:31:41Z2020-01-18T00:31:17Zgeneric port length when integrating existing HDL code with Simulink modelwhen I integrate existing HDL code with Simulink model (as black box), how can I create a component declaration with generic ports length?
for example:
component my_component
generic(GENERIC_OUTPUT_LENGTH: natural := 8)
port (
A, B: in STD_LOGIC;
F : out STD_LOGIC_VECTOR(GENERIC_OUTPUT_LENGTH - 1 downto 0));
end component;
when i use the hdl coder to generate a VHDL code, (GENERIC_OUTPUT_LENGTH - 1 )is repalaced with the specific output port length. however bacuse i use 2 different instantiation (with different ports legnth) of the same block - the generated code require some correction before it can be synthesized. evyatar dhttps://www.mathworks.com/matlabcentral/profile/authors/9422947-evyatar-dtag:www.mathworks.com,2005:Question/4995322020-01-09T00:10:24Z2020-01-18T00:31:14ZWhy are some characters chopped off on the bottom in plots?Below is an example of text from a legend. The top line is chopped but the lower line is not.
Here is some code that can generate the ugliness for you (unless I am mistaken). Just look at the Y-axis text.
figure;
plot([0,1],[0,1])
set(gca,'fontsize',18)
If you increase the fontsize to 19 or larger points then the issue seems to go away. What is going on?David Walwarkhttps://www.mathworks.com/matlabcentral/profile/authors/8647627-david-walwarktag:www.mathworks.com,2005:Question/5008242020-01-17T23:55:48Z2020-01-18T00:25:06ZHow to add a waitbar into an app created in App designer? Not in a separate figure.I have done a lot of research on this and cannot seem to find a solution that is what I am looking for... maybe because what I am trying to do just isn't possible in Matlab, but I am sure there is a way.
I have an app that I am designing in App designer that is in the barebones stages right now... I want to implement a wait bar of some sort into the app along with the other components, i.e. not in a separate figure. Alot of what I have found has been using the waitbar function to open another figure with the waitbar, and I currently am using that right now, but want to get the waitbar inside my app.
I may not be able to use the matlab built in waitbar, and have already tried looking through the code but was not able to replicate the creation of it inside the app.
I know there are many options on the file exchange, but again, nothing that seems to be what I am looking for.
Does anyone know of a way, or can guide me in the right direction as to how I can approach this? Just imagine opening app designer, adding in a button or slider or whatever, and then adding in a waitbar to that same figure, that can update by pressing the button for example.
Hopefully someone has come up with a good solution for this by now and can help me out! Open to all suggestions.
Thank you very much,
AustinAustin Adamhttps://www.mathworks.com/matlabcentral/profile/authors/14630303-austin-adamtag:www.mathworks.com,2005:Question/4897002019-11-06T05:00:00Z2020-01-18T00:00:32ZIs MATLAB compatible with macOS Catalina?Does MATLAB support macOS Catalina (10.15)?
MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:www.mathworks.com,2005:Question/4841632019-10-08T10:47:37Z2020-01-17T23:55:48ZMatlab and MacOS CatalinaAs of today, it is possible to download and install MacOS Catalina. Is there an official document/communication from Mathworks about Matlab compatibility with MacOS Catalina?
There is a pre-existing thread on this topic (https://nl.mathworks.com/matlabcentral/answers/468831-is-matlab-compatible-with-macos-catalina) but I have not found a satisfactory answer on it, and also that information may be outdated now, given that MacOS Catalina has now been finalised.
Thank you
DanieleDaniele Avitabilehttps://www.mathworks.com/matlabcentral/profile/authors/16332933-daniele-avitabiletag:www.mathworks.com,2005:Question/5008152020-01-17T22:42:56Z2020-01-17T23:53:12ZCreate an .m fileCreate an .m file that is a function that creates an array of N random integers in the range from -9999 to 9999. It should be in the form of x=randint(N).
NOTE: This time, upload as an m file, not as a published Word document. You'll be using these functions in a later quiz. But you should test that it works on your own because I will be verifying it in MATLAB when I grade.
Create an .m file that is a function that finds the maximum value in an array of numbers. It should be in the form of max=maxval(x). Do not use built in function max.
NOTE: This time, upload as an m file, not as a published Word document. You'll be using these functions in a later quiz. But you should test that it works on your own because I will be verifying it in MATLAB when I grade.
I have watched the video for this class multiple times and have zero ideas of how to tackle this. These are the first couple of question for the section and I think that if i got helpe on these ones, I could do the rest.Benjamin Trivershttps://www.mathworks.com/matlabcentral/profile/authors/17203739-benjamin-triverstag:www.mathworks.com,2005:Question/4991562020-01-06T22:59:46Z2020-01-17T23:42:48ZTo perform a quad-summationDoes anyone have idea how to perform the following summation?
where,
I used the following code-
Phi01=0.4*pi;
Phi02=0.8*pi;
N1=10;
s=0.4;
P1=linspace(-4,4,N1);
i1=0;
for x=P1
i1=i1+1;
tic
syms v1 v m1 m
Bmv=(2*m)-v;
Bm1v1=(2*m1)-v1;
psimvm1v1=((pi*0.5)*(m-m1))-((2*(Bmv-Bm1v1)*(Bmv+Bm1v1+1)*x*(x^2+1)*log(1-s))...
*(((x^2)+(2*Bmv+1)^2)*((x^2)+(2*Bm1v1+1)^2))^(-1));
lambdamvm1v1=((Bmv+Bm1v1+1)*(x^2+1)*(x^2+(2*Bmv+1)*(2*Bm1v1+1)))*((x^2+(2*Bmv+1)^2)*(x^2+(2*Bm1v1+1)^2))^(-1);
Fmvm1v1=((Phi01)^(v+v1)*(Phi02)^(m+m1-v-v1))...
*(factorial(v)*factorial(v1)*factorial(m-v)*factorial(m1-v1)*(Bmv+Bm1v1+1)*(x^2+1)^(Bmv+Bm1v1))^(-1);
S1 = symsum((Fmvm1v1*(1-s)^(lambdamvm1v1)*cos(psimvm1v1)),v1,0,m1);
S2 = symsum(S1,v,0,m);
S3 = symsum(S2,m1,0,17);
S4 = symsum(S3,m,0,17);
T=(s)^(-1)*(1-S4);
T1(i1)=T;
toc
end
plot(P1(1:i1),T1(1:i1),'b','LineWidth',3);
However, this does not work!Subhajit Bejhttps://www.mathworks.com/matlabcentral/profile/authors/11238623-subhajit-bej