https://www.mathworks.com/matlabcentral/answers/questions.atomMATLAB Answers — New Questions2018-12-13T06:16:35Ztag:www.mathworks.com,2005:Question/4353242018-12-12T10:30:04Z2018-12-13T06:16:35ZWhy is the output my function disregard the IF condition?Hi I've created a function,calcDist to calculate the distance travelled by a weight, W when put on springs, k1 and k2. If the distance travelled by the weight on the first spring, x is greater than the height difference of spring1(k1) and spring 2(k2), d then, the second equation should come in effect. The first equation only serves as a determiner of which case.
function x = calcDist(W,k1,k2,d)
x = W/k1 % equation 1
if x >= d
x = (W+2*k2*d)/(k1+2*k2) % equation 2
else
x = W/k1;
endif
endfunction
The function works for a single value of W.
>> calcDist(500,10^4,1.5*10^4,0.1)
ans = 0.050000
>>
>> calcDist(2000,10^4,1.5*10^4,0.1)
ans = 0.12500
>>
However since I need to plot a graph of x vs W for 0<W<3000N, I tried putting in multiple values at once in the command window
Try = calcDist(0:3000,10^4,1.5*10^4,0.1)
The output given was totally wrong. Somehow it skips the IF condition. I'm totally baffled by this situation. Any help and advice are greatly appreciated.
LuqmanFhttps://www.mathworks.com/matlabcentral/profile/authors/14352816-luqmanftag:www.mathworks.com,2005:Question/4354492018-12-12T21:58:26Z2018-12-13T06:15:36ZNo text appearing in my .txt file using fprintfHello,
I'm trying to write the following string array to a .txt file. However, no data is being written to any file.
label =
19×3 string array
"3182.77" "3211.7042" "Syl_1"
"3305.49" "3311.4764" "Syl_2"
"3321.45" "3351.382" "Syl_3"
"3417.23" "3470.1098" "Syl_4"
"3494.06" "3560.9081" "Syl_5"
I'm trying to write the file to a specific location, so I've included the appropriate directory in my file name:
wavfilecd =
"/Users/aalonso/Documents/Birdsongs/Millibrook/Cohort1/box1_l24y109/UD/L24Y109_43320.47040589_8_8_13_4_0.txt"
I'm using the following code to export my array to a text file.
fopen(wavfilecd,'w');
fprintf(wavfilecd,'%s \t %s \t %s \n',label)
fclose('all');
Right now a file is being created in the right directory, but when I open it there's nothing there. Can anyone help me populate the text file?
Best,
AnaAna Alonsohttps://www.mathworks.com/matlabcentral/profile/authors/14071731-ana-alonsotag:www.mathworks.com,2005:Question/4347442018-12-09T15:12:38Z2018-12-13T06:15:26Zanyway to drag the colorbar to the desired location?is there anyway to drag the colorbar in a desired location, instead of enter the number to determine its location?
Thanks!
YuYu Lihttps://www.mathworks.com/matlabcentral/profile/authors/13996926-yu-litag:www.mathworks.com,2005:Question/4354972018-12-13T05:04:22Z2018-12-13T06:15:18Z Expression or statement is incorrect--possibly unbalanced (, {, or [.i get the following error when calling the multipleGarchPrediction [~ ,~ ,~ ,~ ,~ , LR_POF ((j -1) * length ( filenames )+i ,:) ,Z((j -1)*
length ( filenames )+i ,:) ,gamma ((j -1)* length ( filenames )+(i -1) *3+1:(j -1)* length ( filenames )+(i -1) *3+1+2 ,:) ,alpha ((j -1)* length (
filenames )+(i -1) *3+1:(j -1)* length ( filenames )+(i -1) *3+1+2 ,:) ,beta ((j -1)* length ( filenames )+(i -1) *3+1:(j -1)* length ( filenames )+(i -1)
*3+1+2 ,:) ,delta ((j -1) * length ( filenames )+(i -1) *3+1:(j -1)* length (filenames )+(i -1) *3+1+2 ,:) ] = garchPrediction ( cell2mat ( filenames (
i)),startDate , endDate ,N,T,dist , garchmodel ,q,lambda ,l);
Expression or statement is incorrect--possibly unbalanced (, {, or [.
walid mohammedhttps://www.mathworks.com/matlabcentral/profile/authors/5822460-walid-mohammedtag:www.mathworks.com,2005:Question/4355012018-12-13T05:56:23Z2018-12-13T06:13:56ZWhat is wrong with this code? Need help. Main code:
clear all
close all
clc
M = [1 0 0
0 1 0
0 0 1];
x0=[-0.5; 0.2; 0.5];
options = odeset('Mass',M,'RelTol',1e-12,'AbsTol',[1e-14 1e-14 1e-14], 'Vectorized','on');
global t x y z dt alpha
dt=0.01;
for alpha=0.8800:0.0005:1.6000
alpha
clear n
clear m
[t,x]=ode15s(@equations,0:dt:500,x0);
n=length(x(:,1));
m=floor(n/2);
y=diff(x(m,n,1))/dt; %% Error Message at this line: Index exceeds matrix dimensions
z=diff(y)/dt;
k=1;
clear aa
for i=m:n
t0=t(i); %Comp. local max. pts for m<t<n
option=optimset('display','off');
zer=fsolve(@differ,t0,option);
if interp1(t(m:n-2),z,zer)>0
aa(k)=interp1(t(m:n),x(m:n,1),zer);
k=k+1;
end
end
kmax=k-1;
h=plot(alpha.*ones(1,kmax),aa,'r.');
hold on
set(h,'MarkerSize',0.1);
end
Function equations.m:
function xdot=equations(t,x)
global alpha
a=0.0005; b=0.01; eps=0.01; beta=-1; R=0.3;
xdot(1) = (-x(2) + alpha*x(1)^2 + beta*x(1)^3)/eps;
xdot(2) = x(1) - x(3) - R*x(2);
xdot(3) = a - b*x(2);
xdot = xdot';
end
Function differ.m:
function f=differ(a)
global t x dt
s=diff(x(m:n,1))/dt;
f=interp1(t(m:n-1),s,aa);
end
ZAINULABADIN ZAFARhttps://www.mathworks.com/matlabcentral/profile/authors/12564484-zainulabadin-zafartag:www.mathworks.com,2005:Question/4352932018-12-12T07:31:37Z2018-12-13T06:10:23ZHow to remove TEXT from an ECG image?I have an ECG image as attached. Kindly help me to remove the TEXT regions{I, II, III, avR,aVL...V1 to V5 etc}. Only after removing these regions I an go further in my research study. Please help me to solve this. I use matlab 2012.Sam Roshhttps://www.mathworks.com/matlabcentral/profile/authors/13309556-sam-roshtag:www.mathworks.com,2005:Question/3629942017-10-24T15:48:53Z2018-12-13T06:09:33ZMatlab default app to open .m filesI am trying to associate Matlab with opening of .m files
It is not showing up in my default apps so I cannot make the change as specified below...
Any other ideas?
<https://uk.mathworks.com/matlabcentral/answers/94655-how-do-i-associate-file-types-with-a-certain-application> For Windows 8, Windows 10, and if the file extension is not in a list of file extensions:
1. Right click on any .m file in Windows and select Open With.
2. Select the More Apps option to show a full list of programs installed on your computer.
3. Select MATLAB and make sure the box at the bottom is checked that says "Always use this app to open .m files"Daniel Devinehttps://www.mathworks.com/matlabcentral/profile/authors/11113575-daniel-devinetag:www.mathworks.com,2005:Question/4354462018-12-12T21:08:19Z2018-12-13T06:09:11ZHow can I create a new matrix by using existing values in a column?I've a column inluding the values of
>> B=[0.100;0.250;0.200;0.120;0.080;0.060;0.055;0.040;0.020]
B =
0.1000
0.2500
0.2000
0.1200
0.0800
0.0600
0.0550
0.0400
0.0200
But I want to make it as
0.100 0 0 0 0 0 0 0 0
0.250 0.100 0 0 0 0 0 0 0
0.200 0.250 0.100 0 0 0 0 0 0
0.120 0.200 0.250 0.1 0 0 0 0 0
0.080 0.120 0.200 0.250 0.1 0 0 0 0
0.060 0.080 0.120 0.200 0.25 0.1 0 0 0
0.055 0.060 0.080 0.120 0.2 0.25 0.1 0 0
0.040 0.055 0.060 0.080 0.12 0.2 0.25 0.1 0
0.020 0.040 0.055 0.060 0.08 0.12 0.2 0.25 0.1
How can I do it?Onur Güvenhttps://www.mathworks.com/matlabcentral/profile/authors/13598211-onur-guventag:www.mathworks.com,2005:Question/4355002018-12-13T05:46:38Z2018-12-13T06:05:56ZSwitch Case with a range of letters?OK, I'm just playing with some code. Here's the code:
clear, clc;
while 1
n = input('Type a Word Starting With a Capital Letter: ','s');
n=n(1);
switch n
case 'A'
disp('An A word!')
break;
case 'B'
disp('A B word!')
break;
case 'C'
disp('A C word!')
break;
case 'D' <= 'Z'
disp("try using A,B or C this time")
otherwise
disp('incorrect word, I said use a CAPITAL!')
end
end
I added the "while true" to keep the program running until one of my cases is met. I'm trying to use a range from "D" to "Z" but it doesn't seem to work. I thought the characters were seen as an integer in programming so I'm not sure why it can't evaluate the case?furciferhttps://www.mathworks.com/matlabcentral/profile/authors/13638412-furcifertag:www.mathworks.com,2005:Question/664002013-03-08T10:59:43Z2018-12-13T06:04:21ZMATLAB code for edge detection and segmentation?I am preparing a project on enhancement of feqatures of brain tumor images.Please help me with the MATLAB code for edge detection using Canny Operator and segmentation through Watershed Segmentation??Aru Mehrotrahttps://www.mathworks.com/matlabcentral/profile/authors/4132398-aru-mehrotratag:www.mathworks.com,2005:Question/4354952018-12-13T04:53:58Z2018-12-13T06:03:02ZHOW SHOULD DRAW THIS IN LOOP FORM? WHERE IS THE PROBLEM IN MY CODE?my code:
s=0;
for n=1:0.01:10
s=s+(-1^n+1*sin(n*pi*x));
end
f=(2/pi)*s;
plot(x,f)
Where is wrong in my code?HADIMARGOhttps://www.mathworks.com/matlabcentral/profile/authors/14322242-hadimargotag:www.mathworks.com,2005:Question/4354852018-12-13T04:04:13Z2018-12-13T06:01:42ZAssign values to a new variable via a functionI have a repetitve task that I want to turn into a function. The process that I am repeating at the moment for many variables is:
load('names_v1.mat')
names_v2 = names_v1;
save('names_v2','names_v2')
To turn this process into a function the bit I am struggling with is line two. That is in the below function the line namesNew = namesOld will obviously not work becuase namesOld is the string with the variable name and not the variable itself. I was trying to use the variableValues function but that doesn't seem appropriate
function test = fileRet(oldVersion, newVersion)
% old verion might be 'v1'
% new version might be 'v2'
namesOld = strcat('names_', oldVersion);
namesNew = strcat('names_', newVersion);
load(namesOld)
% Below line is the line that doesn't work
namesNew = namesOld;
save(namesNew,namesNew)
end
Any ideasTatiana Bernardhttps://www.mathworks.com/matlabcentral/profile/authors/14357782-tatiana-bernardtag:www.mathworks.com,2005:Question/4354902018-12-13T04:37:13Z2018-12-13T05:56:55ZHow to add 1 zero element to the 1st element of my vector?Hi everyone,
This is a a simple question. I wanna add one element which is zero to my first element and change the size of my vector. For example:
A=[1,2,3] and I want it to be A=[0,1,2,3].
Thank you in advance.Amir Amjadianhttps://www.mathworks.com/matlabcentral/profile/authors/12151999-amir-amjadiantag:www.mathworks.com,2005:Question/4350492018-12-10T22:22:47Z2018-12-13T05:55:07ZPlease help me create Decimal to Two's Complement/ Two's Complement to Decimal function without using the built-in function in MatlabHello Everyone,
My goal here is to create the Decimal to Two's Complement/ Two's Complement to Decimal function without using the built-in function in Matlab , aslo to create hexadecimal number to decimal number and vise versa. without using hex2dec & dec2hex.
Your input is much appreciated.
Thank you.Irwin2000https://www.mathworks.com/matlabcentral/profile/authors/12752529-irwin2000tag:www.mathworks.com,2005:Question/4352772018-12-12T04:05:27Z2018-12-13T05:53:01ZHello all, can someone help me to extract data from SGM files( reuter-21578)?Can I know how to extract data from SGM files (reuter-21578)? Inside reuter-21578 have 22 files(reut2-000 - reut2-021). can I have the source code to extract it?cecilia gohhttps://www.mathworks.com/matlabcentral/profile/authors/14350981-cecilia-gohtag:www.mathworks.com,2005:Question/4354962018-12-13T05:02:29Z2018-12-13T05:47:17Zobtain data using columns data indicesi have data A=( 3,5,3,1,4 ) in a column and
B=[ 4 6 9 1 3
2 7 2 5 7
7 3 1 8 2
4 1 6 9 1
2 5 8 3 6]
and i want: as in A first element is 3 and for this i want to get first element of column 3 row 1 from B which is 9. The second element of A is 5 and for this i want to get the the 2nd element of column 5 and row 2 from B which is 7 ,and do the process for all other elements . how to do this? the requried elememts are bold and underlined
any help will be really appriciated.........thanks in advance
Farman Shahhttps://www.mathworks.com/matlabcentral/profile/authors/13190684-farman-shahtag:www.mathworks.com,2005:Question/4354892018-12-13T04:35:59Z2018-12-13T05:46:35Zi am getting this error :Undefined variable "comm" or class "comm.OFDMModulator".please explain how to define the class.thanksqpskMod = comm.QPSKModulator;
qpskDemod = comm.QPSKDemodulator;
ofdmMod = comm.OFDMModulator('FFTLength',128,'PilotInputPort',true, 'PilotCarrierIndices',[12;26;40;54],'InsertDCNull',false, 'NumTransmitAntennas',2);
ofdmDemod = comm.OFDMDemodulator(ofdmMod);
ofdmDemod.NumReceiveAntennas = 2;purva kamathttps://www.mathworks.com/matlabcentral/profile/authors/14352501-purva-kamattag:www.mathworks.com,2005:Question/4354992018-12-13T05:35:27Z2018-12-13T05:41:11ZDilation of Specific pointsI have a binary zero matrix form of an image.Now I wonder,how to perform dilation morphological operation only on certain locations(to be read from a 2D array) so that the locations would likely turn as disk shapes (using strel('disk',r) function) having value as 1's and rest of the part as 0's; Suganthi Khttps://www.mathworks.com/matlabcentral/profile/authors/11955405-suganthi-ktag:www.mathworks.com,2005:Question/4354782018-12-13T02:46:20Z2018-12-13T05:37:41ZHow to replace approximate real numbers near zero in expression with exact integer 0?Sometimes we have very small coefficients in symbolic operations.
syms x y
y = sin(pi)*x;
The result is
y =(4967757600021511*x)/40564819207303340847894502572032
How to replace approximate real numbers near zero in expression with exact integer 0?lei jianghttps://www.mathworks.com/matlabcentral/profile/authors/14192430-lei-jiangtag:www.mathworks.com,2005:Question/4344162018-12-07T12:34:10Z2018-12-13T05:36:46ZUse MATLAB to compute a 6-point moving averageUse MATLAB to compute a 6-point moving average of the input signal, x[n] = 5sin(pi n /10 + pi/ 4) , for 0 lowest than or equal n greater than or equal 69. Display a MATLAB plot of the output signal.mariam mohamed alyassihttps://www.mathworks.com/matlabcentral/profile/authors/11436353-mariam-mohamed-alyassitag:www.mathworks.com,2005:Question/4347262018-12-09T13:11:16Z2018-12-13T05:35:01ZThe image is from a leaf, I want to find the discontinuous points ,which is because of the bugbite. How can I find these points as fast as I can？yinghui zhuhttps://www.mathworks.com/matlabcentral/profile/authors/11388283-yinghui-zhutag:www.mathworks.com,2005:Question/4354812018-12-13T02:51:48Z2018-12-13T05:34:56Zthird party error, install arduino hardware support packageI tried to install arduino hardware support package but facing error with the third party.
I have tried to run the matlab as admin, and download the simulink support package but still does not work
Could you give me the suggestion?
(I'm using MATLAB 2017a)
Thank you
JJJirada Gosumbonggothttps://www.mathworks.com/matlabcentral/profile/authors/11253605-jirada-gosumbonggottag:www.mathworks.com,2005:Question/4352672018-12-12T02:53:10Z2018-12-13T05:31:59ZBuilding Simevents model with Matlab code. Setting the output switch 'number of ports' parameter.Hello, I am trying to build a simevents model using matlab code since it's a big and complex model and is more accurate and quicker to proceed this way.
I am having a problem setting the parameter for the entity output switch regarding the number of ports. When i call the parameter 'ports' in the add_block command, the system returns an error saying that this parameter is read only.
Do you know any way I could get around this?
this is what I m writing:
add_block('built-in/entityoutputswitch',[sys '/os'],'Position',pos,'outputports','70')
and this is what I get:
Error using model (line 53)
EntityOutputSwitch block parameter 'OutputPorts' is read-onlyMarco Fantihttps://www.mathworks.com/matlabcentral/profile/authors/9237870-marco-fantitag:www.mathworks.com,2005:Question/4354712018-12-13T01:51:35Z2018-12-13T05:31:16Z"size(I, 3)" when ran on an RGB image returns ans as "1" when that is not the case. function mainfunctionGaus(MyFileName)
if size(MyFileName,3) == 3
disp('RGB')
MyConvRGB(MyFileName);
else
disp('GSCale')
MyConvGreyTest(MyFileName);
end
end
The above is my code and the image stored in "MyFileName" is this:
What should be happening is the function "MyConvRGB" should be ran by the if statement I put in but since size is giving me an incorrect answer it puts it through my greyscale code.
Shawn Williamsonhttps://www.mathworks.com/matlabcentral/profile/authors/14313724-shawn-williamsontag:www.mathworks.com,2005:Question/4350962018-12-11T07:06:41Z2018-12-13T05:29:13Zhow can i complete the missing data in a cell to complete the cell. i tried imfill command but not works for me. thanks for your time.Arshad Alihttps://www.mathworks.com/matlabcentral/profile/authors/10141786-arshad-alitag:www.mathworks.com,2005:Question/4074702018-06-26T10:39:49Z2018-12-13T05:28:25Zerro using helperCIFAR10Datahi,
when I am running the code ( <https://uk.mathworks.com/help/vision/examples/object-detection-using-deep-learning.html Object Detection Using Deep Learning> ) I see this error!! it use to work but have no idea why it doesn't now!! Im using MATLAB 2018a
Error using reshape
Product of known dimensions, 3072, not divisible into total number of elements, 1.
Error in helperCIFAR10Data>loadBatchAsFourDimensionalArray (line 53)Abohttps://www.mathworks.com/matlabcentral/profile/authors/5840315-abotag:www.mathworks.com,2005:Question/4354832018-12-13T03:12:46Z2018-12-13T05:27:12Zbwconncomp doesn't count correctlyI'm having troubles counting bacterial colonies using bwconncomp function ......as it counts adjecent colonies as one single spot and also count the outer boundaries of the plate holding the bacteria ..... , This is my first time to write full code and I have to handle this project soon so I'm in desperate need of help .
I=imread('2010-07-28-17.06.301.jpg');
imshow(I);
h = imfreehand; %draw something
M = ~h.createMask();
I(M) = 0; % mask out the borders
imshow(I);
dim=size(I);
g=rgb2gray(I);
bw = im2bw(I,0.6);
se=strel('disk',4);
T=imopen(bw,se);
imshow(T);
T=imcomplement(T);
T=flipud(T);
BW_filled = imfill(T,'holes');
TT=imcrop(T); % remove borders
N=imcomplement(TT);
CC = bwconncomp(N,8);
imshow(T);
disp(CC);
original image
Eilaf Badrhttps://www.mathworks.com/matlabcentral/profile/authors/14346304-eilaf-badrtag:www.mathworks.com,2005:Question/4354982018-12-13T05:20:32Z2018-12-13T05:20:32ZGetting error Undefined function or variable 'iqf' with datafeedtoolboxWhen I run the command
>> c = iqf(username,password)
Undefined function or variable 'iqf'.Chrishttps://www.mathworks.com/matlabcentral/profile/authors/2982779-christag:www.mathworks.com,2005:Question/4354882018-12-13T04:24:24Z2018-12-13T05:17:05Zhow to lapace results how to plot this please
deqdiff = 'diff(y(t),t,t) + y(t) - cos(t)'
ldeqdiff = laplace(deqdiff,t,s)
sldeqdiff = subs(ldeqdiff,{'D(y)(0)','y(0)'},{1,1})
syms Ys
ldeqinit = subs(sldeqdiff,'laplace(y(t),t,s)',Ys)
ly = solve(ldeqinit,Ys)
ilaplace(ly,s,t)Brenda Galabehttps://www.mathworks.com/matlabcentral/profile/authors/13307459-brenda-galabetag:www.mathworks.com,2005:Question/4353932018-12-12T15:41:45Z2018-12-13T05:16:38ZimageSegmenter App regarding,(using texture features)How to use 'include texture features' in the imageSegmenter App of Matlab?
Whether it has to be selected after marking foreground & background? I could not see any effect upon selection. So pls give instructions.Deepak Sivadashttps://www.mathworks.com/matlabcentral/profile/authors/13259356-deepak-sivadastag:www.mathworks.com,2005:Question/4354922018-12-13T04:46:51Z2018-12-13T05:04:24Zfinding laplace transform of heaviside function
trying to get lapace and plot :
θ” + 2θ′ + 6θ = [H(t) − H(t − 1)],
θ(0) = 4, θ′ (0) = 5,
H is the Heaviside function defined by
H(t) = { 0, x < 0, 1, x ≥ 0.
Find and sketch θ(t).
my code : error with dsolve
laplace('heaviside(t)-heaviside(t-1)',t,s)
syms t theta gensoln initsoln
eq = 'D2theta + 2*Dtheta + 6*theta -heaviside(t)+heaviside(t-1)'
initsoln = dsolve(deq,'theta(0)=6, Dtheta(0)=6', 't')
pretty(initsoln)Brenda Galabehttps://www.mathworks.com/matlabcentral/profile/authors/13307459-brenda-galabetag:www.mathworks.com,2005:Question/4351162018-12-11T09:59:08Z2018-12-13T05:02:33ZDelete the string symbols on specific line with special symbol.Hi I have file fomated like that.
# 1996 3 4 9 58 11.0 20.2810 106.3000 20.8 2.7 0.0 0.0 0.5 1
PLV 12.20 1.00 Pg
PLV 21.00 0.75 Sg
HNV 16.20 1.00 Pg
HNV 28.40 0.75 Sg
# 1996 3 29 10 34 43.4 20.8820 107.2830 28.5 2.6 0.0 0.0 0.7 2
PLV 12.20 1.00 Pg
PLV 20.60 0.75 Sg
Now I need to remove the number on line have symbol "#" from
# 1996 3 4 9 58 11.0 20.2810 106.3000 20.8 2.7 0.0 0.0 0.5 1
to
# 1
Mean that all so thing after "#" to last number need to be remove (between # and number have 4 <space>). Final I need the file like that
# 1
PLV 12.20 1.00 Pg
PLV 21.00 0.75 Sg
HNV 16.20 1.00 Pg
HNV 28.40 0.75 Sg
# 2
PLV 12.20 1.00 Pg
PLV 20.60 0.75 Sg
Any one can help me! I try few way but it remove all or change the string only.Long Hà Vinhhttps://www.mathworks.com/matlabcentral/profile/authors/6357385-long-ha-vinhtag:www.mathworks.com,2005:Question/4354822018-12-13T02:59:33Z2018-12-13T05:01:19Zcan I make imfreehand only draw fixed circles as I need to crop circular section from my image can I make imfreehand only draw fixed circles as I need to crop circular section from my image Eilaf Badrhttps://www.mathworks.com/matlabcentral/profile/authors/14346304-eilaf-badrtag:www.mathworks.com,2005:Question/4344852018-12-07T17:57:42Z2018-12-13T04:56:51ZHOW I COULD DRAW THIS FUNCTIONHADIMARGOhttps://www.mathworks.com/matlabcentral/profile/authors/14322242-hadimargotag:www.mathworks.com,2005:Question/4354942018-12-13T04:48:08Z2018-12-13T04:52:18Zhow to get activation key for a trial versioni have downloaded the trial version and instaaling and it is asking for lisence or activation key , i have given the mathworks user id and password during installation but not receiving any lisence into mail id or to the mathwork account, please helpkavya jthttps://www.mathworks.com/matlabcentral/profile/authors/5839050-kavya-jttag:www.mathworks.com,2005:Question/4354382018-12-12T20:37:12Z2018-12-13T04:48:01ZIf i have a matrix with each row elements represent a position in 3 Dimensional plane which can be plotted to be chaotic movement of particle. how can i animated the plot?%i am using an ode45 of the integration with lorenz equationRandy Hakimhttps://www.mathworks.com/matlabcentral/profile/authors/14285354-randy-hakimtag:www.mathworks.com,2005:Question/4354932018-12-13T04:47:37Z2018-12-13T04:47:37ZIs it possible to run an App Designer app on an installation of Matlab which does not have App Designer?Does Matlab need App Designer or any toolbox to run an app created using App Designer?Sidhanth Guptahttps://www.mathworks.com/matlabcentral/profile/authors/12665021-sidhanth-guptatag:www.mathworks.com,2005:Question/4354082018-12-12T16:34:26Z2018-12-13T04:47:19Zfinding general solution of differential equation the general solution (involving constants of integration C1, C2. so far i have eigen values and vectors. need to get general solution not sure how
A = sym([.9375, 0 , 0; .9375 -.625 0; 0 .625 -.556])
eig(A)
[V,D]=eig(A)
solution i get is
A =
[ 15/16, 0, 0]
[ 15/16, -5/8, 0]
[ 0, 5/8, -139/250]
ans =
-5/8
-139/250
15/16
V =
[ 0, 0, 2987/750]
[ -69/625, 0, 2987/1250]
[ 1, 1, 1]
D =
[ -5/8, 0, 0]
[ 0, -139/250, 0]
[ 0, 0, 15/16]
attached is the math part.
Brenda Galabehttps://www.mathworks.com/matlabcentral/profile/authors/13307459-brenda-galabetag:www.mathworks.com,2005:Question/4354912018-12-13T04:40:03Z2018-12-13T04:43:06ZUndefined function or variable 'multisvm'.output = multisvm(data_latih,target_latih,data_latih);
Undefined function or variable 'multisvm'.
Error in pelatihan (line 36)
output = multisvm(data_latih,target_latih,data_latih);Wildan Arif Gumilarhttps://www.mathworks.com/matlabcentral/profile/authors/14355349-wildan-arif-gumilartag:www.mathworks.com,2005:Question/4350552018-12-10T23:21:35Z2018-12-13T04:39:57ZSubstituting solutions in system of differential equationsI have a system of three differential equations. In this case, it is a simple enough idea to solve the first for x1...sub value for x1 into second equation, solve for x2 and sub it into the third equation.
This was working out fine until I reached the final substitution. If it hadn't worked from the start then I probably wouldn't be as puzzled.
Alpha, beta, and delta are to remain undefined in this context, and simply carried through in each equation.
Dx1 = p - x1*alpha
Dx2 = x1*alpha - x2*beta
Dx3 = x2*beta - x3*delta
x1(0)=0, x2(0)=0, x3(0)=0
I can't imagine that the introduction of "delta" is my problem. Have I asked too much of "dsolve"?
Thank you for any advice you have. I'll keep checking into the errors, but they haven't shed any light on the situation for me yet.
>> soln1 = dsolve('Dx1 = p - x1*alpha','x1(0) = 0', ' t ' )
soln1 =
(p - p/exp(alpha*t))/alpha
>> soln2 = dsolve('Dx2 = soln1*alpha - x2*beta','x2(0) = 0', ' t ' )
soln2 =
(alpha*soln1 - (alpha*soln1)/exp(t*beta))/beta
>> soln3 = dsolve('Dx3 = soln2*beta - x3*delta','x3(0) = 0', ' t ' )
??? Error using ==> mupadmex
Error in MuPAD command: Illegal variable context [DOM_VAR];
during evaluation of 'solvelib::indets'
Error in ==> sym.sym>sym.mupadmexnout at 2003
out = mupadmex(fcn,args{:});
Error in ==> dsolve>mupadDsolve at 190
[var_list,R] = mupadmexnout('mllib::dsolve',sys,x,ignoreConstraints);
Error in ==> dsolve at 97
[R,vars] = mupadDsolve(ignoreConstraints,varargin{1:narg});spcrookshttps://www.mathworks.com/matlabcentral/profile/authors/14224905-spcrookstag:www.mathworks.com,2005:Question/4338732018-12-05T01:11:20Z2018-12-13T04:36:28Znot enough input argumentsI am trying to call the function but it doesnt run. i have been trying to feed some input arguments but still there is something wrong wich i cant understand. I have uploaded the file here...anyone help? thankswalid mohammedhttps://www.mathworks.com/matlabcentral/profile/authors/5822460-walid-mohammedtag:www.mathworks.com,2005:Question/4354862018-12-13T04:05:56Z2018-12-13T04:34:59Zhow to detect the range of brain tumorwho to karimulla shaikhttps://www.mathworks.com/matlabcentral/profile/authors/14358383-karimulla-shaiktag:www.mathworks.com,2005:Question/1555712014-09-20T12:58:18Z2018-12-13T04:28:14ZMAKING SUBJECT OF FOMULARHOW DO I MAKE X SUBJECT OF FOMULAR IN THIS EQUATION x = exp(x+y).
I have tried the following code
syms x y
solve('x = exp(x+y)',x)
and this give me
*
[sym empty].*
How best can I do it.lloyd mukunzahttps://www.mathworks.com/matlabcentral/profile/authors/4027519-lloyd-mukunzatag:www.mathworks.com,2005:Question/564392012-12-12T18:39:33Z2018-12-13T04:26:47Zwhat is the syntaxis for numerical solvers?Hi, for the last hour I am trying to start the numerical solver..
The copy-past from "help"
numeric::solve([sin(x) = y^2 - 1, cos(x) = y], [x, y]);
gives
Error: Unexpected MATLAB operator
for '::'
I can also use the other syntaxis option, which works fine in my script:
syms ha r2 positive; [h,rcone] = solve( hh(ha,r2) == 0, VV(ha,r2) == V0);
If use this, how do I define the range of ha and r2 in which I want the solutions?
Petrhttps://www.mathworks.com/matlabcentral/profile/authors/1874557-petrtag:www.mathworks.com,2005:Question/4351742018-12-11T14:29:53Z2018-12-13T04:25:01ZPrint the power of a vehicle with time array entriestThe time interval I am using is set as
t = 0:0.01:3
And I want to calculate the Power of vehicle, which is a time function: P = F*v, where F: forces & v = 5.*t (velocity)
The problem is, I cannot print the values of this function (P). Can anyone please help?Thalassia Nounihttps://www.mathworks.com/matlabcentral/profile/authors/13107756-thalassia-nounitag:www.mathworks.com,2005:Question/4354702018-12-13T01:44:03Z2018-12-13T04:22:22Znnet simulaton errror Mixed intergerI am getting a Mixed integer class inputs are not supported error when I simulate my Nnet. I even changed all the input maxrix to zero and I get the same error
>> WeekAheadLoadForecast
performance =
2.1066
trainPerformance =
2.1269
valPerformance =
2.0739
testPerformance =
1.9771
Error using bsxfun
Mixed integer class inputs are not supported.
Error in mapminmax.apply (line 6)
y = bsxfun(@minus,x,settings.xoffset);
Error in nnet.mode.matlab.processInput (line 7)
x = hints.inp(i).procApply{j}(x,hints.inp(i).procSet{j});
Error in nnet.mode.matlab.processInputs (line 12)
xp = nnet.mode.matlab.processInput(x,i,hints);
Error in nncalc.preCalcData (line 16)
data.Pc = nnet.mode.matlab.processInputs(net,[data.Xi data.X],data.Q,hints);
Error in nncalc.setup1>setupImpl (line 180)
calcData = nncalc.preCalcData(matlabMode,matlabHints,net,data,doPc,doPd,calcHints.doFlattenTime);
Error in nncalc.setup1 (line 16)
[calcMode,calcNet,calcData,calcHints,net,resourceText] = setupImpl(calcMode,net,data);
Error in network/sim>nncalc_setup (line 761)
[calcMode,calcNet,calcData,calcHints,net,resourceText] = nncalc.setup1(calcMode,net,data);
Error in network/sim (line 274)
[calcLib,calcNet,net,resourceText] = nncalc_setup(calcMode,net,data);
Error in LoadForecastNN (line 6)
Yint = sim(net, Xint')';
Error in WeekAheadLoadForecast (line 31)
[YFcstNN] = LoadForecastNN(net,XFcstNN);Kevin Maxwellhttps://www.mathworks.com/matlabcentral/profile/authors/13875229-kevin-maxwelltag:www.mathworks.com,2005:Question/4354772018-12-13T02:41:02Z2018-12-13T04:19:07ZHow to have Matlab publish commands executed in the editor window?I have found the publish menu in Matlab. I would like to reference it in my code so as to save output ( without the commands) and all figures. I am using only figure1 throughout. I want to save in two formats pdf and doc.
Where do I put the publish command at the beginning or at the end of my code or putting it another way should I execute the publish commands at beginning? Matlab software keeps telling me it cannot find the file? Further I want to include all graphs. I have added snapnow after each plot.
I have used the following code both at beginning and end of my program. I want to include all graphs but no input commands only output. Options can be seen on edit publishing options window. I tried to start simple.
Code tried:
publish('c:\data\output.doc')
publish('c:\data\output.doc','doc')
Error message
Cannot find "c:\data\output.doc"
I am trying to avoid the repetitive point and click interface. I have many analyses to do. Can you help?
Thank you. MM
release button is not working....
>> ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.4.0.949201 (R2018a) Update 6
MATLAB License Number: STUDENT
Operating System: Microsoft Windows 10 Home Version 10.0 (Build 17134)
Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.4 (R2018a)
Curve Fitting Toolbox Version 3.5.7 (R2018a)
Global Optimization Toolbox Version 3.4.4 (R2018a)
Optimization Toolbox Version 8.1 (R2018a)
Statistics and Machine Learning Toolbox Version 11.3 (R2018a)
Symbolic Math Toolbox Mary Marionhttps://www.mathworks.com/matlabcentral/profile/authors/1739218-mary-mariontag:www.mathworks.com,2005:Question/4354802018-12-13T02:51:12Z2018-12-13T04:13:29ZI'm trying to install 2018b version of matlab and couldn't complete the licensing, it said that my license file does not include the network license and I have to mod the network.lic. How can I do that?Right now I'm trying to install my R2018b on my university server, with the license file that generate from my mac address downloaded from the mathwork website. The installation went on smoothly until nearly the end. The noticed pop up and said that my license file doesn't included the network license and I have to modified my network.lic file which I can learned from the tutorials on the website, so I follow the link and there is nothing related to the solution I'm looking for. Could you at least provided the solid link for this kind of problem or are there any way to avoid this ruckus?Suwin Sleesongsomhttps://www.mathworks.com/matlabcentral/profile/authors/13054582-suwin-sleesongsomtag:www.mathworks.com,2005:Question/4353992018-12-12T16:04:56Z2018-12-13T04:06:39Zplease can anyone help me about this equation. theta value is 0 to 2piThe question is in the attachment with the question.Hein zawhttps://www.mathworks.com/matlabcentral/profile/authors/14355293-hein-zawtag:www.mathworks.com,2005:Question/285372012-02-09T11:19:18Z2018-12-13T04:05:51ZSet the Yticklabel to different colors Hi all,
I used this code to set the color of XLable:xlabel('\color{magenta}Love').It works.But I used this way to set the color of Yticklabel,it didn't work(set(h,'Yticklabel',{'\color{magenta}Love','b'})).I want to know how I can set the Yticklabel to different colors.
Thanks for all your kindly answering.
yang yanghttps://www.mathworks.com/matlabcentral/profile/authors/3161535-yang-yang