Email: [email protected]

This Portal for internal use only!

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • IBM
  • Visual Paradigm
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Categories
  • Microsoft
    • Microsoft Apps
    • Office
    • Operating System
    • VLS
    • Developer Tools
    • Productivity Tools
    • Database
    • AI + Machine Learning
    • Middleware System
    • Learning Services
    • Analytics
    • Networking
    • Compute
    • Security
    • Internet Of Things
  • Adobe
  • Matlab
  • Google
  • Visual Paradigm
  • WordPress
    • Plugin WP
    • Themes WP
  • Opensource
  • Others
More Categories Less Categories
  • Get Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • My Account
    • Download
    • Cart
    • Checkout
    • Login
  • About Us
    • Contact
    • Forum
    • Frequently Questions
    • Privacy Policy
  • Forum
    • News
      • Category
      • News Tag

iconTicket Service Desk

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • IBM
  • Visual Paradigm
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Menu
  • Home
    • Download Application Package Repository Telkom University
    • Application Package Repository Telkom University
    • Download Official License Telkom University
    • Download Installer Application Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • All Pack
    • Microsoft
      • Operating System
      • Productivity Tools
      • Developer Tools
      • Database
      • AI + Machine Learning
      • Middleware System
      • Networking
      • Compute
      • Security
      • Analytics
      • Internet Of Things
      • Learning Services
    • Microsoft Apps
      • VLS
    • Adobe
    • Matlab
    • WordPress
      • Themes WP
      • Plugin WP
    • Google
    • Opensource
    • Others
  • My account
    • Download
    • Get Pack
    • Cart
    • Checkout
  • News
    • Category
    • News Tag
  • Forum
  • About Us
    • Privacy Policy
    • Frequently Questions
    • Contact
Home/Archive for

Author: PuTI

How to use neural networks toolbox on simulink for controlling a dynamic plant of quadcopter that is using 6DoF Euler Angles Simulink block
Matlab News

How to use neural networks toolbox on simulink for controlling a dynamic plant of quadcopter that is using 6DoF Euler Angles Simulink block

PuTI / 2025-06-07

Hello all,
I have done a model for controlling roll, pitch, yaw and Z of a quadcopter, I did it using the 6DoF Euler Angles Simulink´s Block, and I have solved the controll both, with using fuzzy controllers and also with a PID.
Now I am trying to use neural networks for control it, and I have tryed the control blocks (Model-Reference and predictive controller), but I don´t know how to use them for this scenario on a propper way, or how I should redo the plant. Because until now, with the other controllers I pick each of the outputs and I do deacoupled control for each one and join them again.
I will be very thanked for any help, thank you.
Regards.Hello all,
I have done a model for controlling roll, pitch, yaw and Z of a quadcopter, I did it using the 6DoF Euler Angles Simulink´s Block, and I have solved the controll both, with using fuzzy controllers and also with a PID.
Now I am trying to use neural networks for control it, and I have tryed the control blocks (Model-Reference and predictive controller), but I don´t know how to use them for this scenario on a propper way, or how I should redo the plant. Because until now, with the other controllers I pick each of the outputs and I do deacoupled control for each one and join them again.
I will be very thanked for any help, thank you.
Regards. Hello all,
I have done a model for controlling roll, pitch, yaw and Z of a quadcopter, I did it using the 6DoF Euler Angles Simulink´s Block, and I have solved the controll both, with using fuzzy controllers and also with a PID.
Now I am trying to use neural networks for control it, and I have tryed the control blocks (Model-Reference and predictive controller), but I don´t know how to use them for this scenario on a propper way, or how I should redo the plant. Because until now, with the other controllers I pick each of the outputs and I do deacoupled control for each one and join them again.
I will be very thanked for any help, thank you.
Regards. neural networks control, 6dof euler angles controller MATLAB Answers — New Questions

​

How to plot specific rows from table
Matlab News

How to plot specific rows from table

PuTI / 2025-06-07

I am trying to plot data based on the specimen id, I have two types of speciments. 0.12C and 0.07C Steel, as seen in the photo here is the table.

I would like to plot the data with different markers for each Plate ID, but i can’t seem to figure out how to plot them. I have tried calling out the rows and varible when plotting but it won’t work.
Here is how i load the data:
Table4 = readtable(‘Grain Size.xlsx’,’sheet’,’KIC Master’,’VariableNamingRule’,’preserve’);
Here is how I am trying to plot:
plot(ax2,Table4(1:7,"Ferrite Grain Size-1/2 (in.)"),Table4(1:7,"Provisional To °F"),’Color’,’black’,’LineStyle’,’none’,’Marker’,’x’,’MarkerEdgeColor’,’black’,’MarkerFaceColor’,’black’);
plot(ax2,Table4(8:11,"Ferrite Grain Size-1/2 (in.)"),Table4(8:11,"Provisional To °F"),’Color’,’black’,’LineStyle’,’none’,’Marker’,’S’,’MarkerEdgeColor’,’black’,’MarkerFaceColor’,’black’);
I get this error:
Error using plot
Invalid subscript for Y. A table variable subscript must be a numeric array containing real positive integers, a logical array, a character vector, a string array, a cell
array of character vectors, or a pattern scalar used to match variable names.Error using plot
Invalid subscript for Y. A table variable subscript must be a numeric array containing real positive integers, a logical array, a character vector, a string array, a cell
array of character vectors, or a pattern scalar used to match variable names.

What am I missing here? The only way i have gotten this kind of thing to work in the past is by creating seaperate tables for each specimen type then plotting each table individually. I would like to at least keep them in the same table and be able to call our which rows I want to plot.
Thank You!I am trying to plot data based on the specimen id, I have two types of speciments. 0.12C and 0.07C Steel, as seen in the photo here is the table.

I would like to plot the data with different markers for each Plate ID, but i can’t seem to figure out how to plot them. I have tried calling out the rows and varible when plotting but it won’t work.
Here is how i load the data:
Table4 = readtable(‘Grain Size.xlsx’,’sheet’,’KIC Master’,’VariableNamingRule’,’preserve’);
Here is how I am trying to plot:
plot(ax2,Table4(1:7,"Ferrite Grain Size-1/2 (in.)"),Table4(1:7,"Provisional To °F"),’Color’,’black’,’LineStyle’,’none’,’Marker’,’x’,’MarkerEdgeColor’,’black’,’MarkerFaceColor’,’black’);
plot(ax2,Table4(8:11,"Ferrite Grain Size-1/2 (in.)"),Table4(8:11,"Provisional To °F"),’Color’,’black’,’LineStyle’,’none’,’Marker’,’S’,’MarkerEdgeColor’,’black’,’MarkerFaceColor’,’black’);
I get this error:
Error using plot
Invalid subscript for Y. A table variable subscript must be a numeric array containing real positive integers, a logical array, a character vector, a string array, a cell
array of character vectors, or a pattern scalar used to match variable names.Error using plot
Invalid subscript for Y. A table variable subscript must be a numeric array containing real positive integers, a logical array, a character vector, a string array, a cell
array of character vectors, or a pattern scalar used to match variable names.

What am I missing here? The only way i have gotten this kind of thing to work in the past is by creating seaperate tables for each specimen type then plotting each table individually. I would like to at least keep them in the same table and be able to call our which rows I want to plot.
Thank You! I am trying to plot data based on the specimen id, I have two types of speciments. 0.12C and 0.07C Steel, as seen in the photo here is the table.

I would like to plot the data with different markers for each Plate ID, but i can’t seem to figure out how to plot them. I have tried calling out the rows and varible when plotting but it won’t work.
Here is how i load the data:
Table4 = readtable(‘Grain Size.xlsx’,’sheet’,’KIC Master’,’VariableNamingRule’,’preserve’);
Here is how I am trying to plot:
plot(ax2,Table4(1:7,"Ferrite Grain Size-1/2 (in.)"),Table4(1:7,"Provisional To °F"),’Color’,’black’,’LineStyle’,’none’,’Marker’,’x’,’MarkerEdgeColor’,’black’,’MarkerFaceColor’,’black’);
plot(ax2,Table4(8:11,"Ferrite Grain Size-1/2 (in.)"),Table4(8:11,"Provisional To °F"),’Color’,’black’,’LineStyle’,’none’,’Marker’,’S’,’MarkerEdgeColor’,’black’,’MarkerFaceColor’,’black’);
I get this error:
Error using plot
Invalid subscript for Y. A table variable subscript must be a numeric array containing real positive integers, a logical array, a character vector, a string array, a cell
array of character vectors, or a pattern scalar used to match variable names.Error using plot
Invalid subscript for Y. A table variable subscript must be a numeric array containing real positive integers, a logical array, a character vector, a string array, a cell
array of character vectors, or a pattern scalar used to match variable names.

What am I missing here? The only way i have gotten this kind of thing to work in the past is by creating seaperate tables for each specimen type then plotting each table individually. I would like to at least keep them in the same table and be able to call our which rows I want to plot.
Thank You! plotting MATLAB Answers — New Questions

​

how to build array  using   matlab.graphics.chart.primitive.Line’ property
Matlab News

how to build array using matlab.graphics.chart.primitive.Line’ property

PuTI / 2025-06-07

Look this example:
selected = findobj(allLines,’Type’,’line’,’LineWidth’,0.5);
[cc]=selected;
selected 13×1
xx selected 13×1
this is ok
now i try to use selected property:
selected.Color
it give me 13×1 color!
now i try to record information in array but it’s not possible

[cc]=selected.Color
now i see cc have only the first element!
can i do it?Look this example:
selected = findobj(allLines,’Type’,’line’,’LineWidth’,0.5);
[cc]=selected;
selected 13×1
xx selected 13×1
this is ok
now i try to use selected property:
selected.Color
it give me 13×1 color!
now i try to record information in array but it’s not possible

[cc]=selected.Color
now i see cc have only the first element!
can i do it? Look this example:
selected = findobj(allLines,’Type’,’line’,’LineWidth’,0.5);
[cc]=selected;
selected 13×1
xx selected 13×1
this is ok
now i try to use selected property:
selected.Color
it give me 13×1 color!
now i try to record information in array but it’s not possible

[cc]=selected.Color
now i see cc have only the first element!
can i do it? how to build array using matlab.graphics.chart. MATLAB Answers — New Questions

​

Problems running docker image from linux x11 host
Matlab News

Problems running docker image from linux x11 host

PuTI / 2025-06-07

Hi everyone
I am a linux user and i have an arch installation running with X11 desktop management on my pc. I always struggled to run matlab on my laptop (interface wont open and stuff like that) since arch is not officially supported and i deferred to using the online version. After a bit i fixed the problems and started using the desktop version without issue up untill the last month when the glibc packag updated to the 2.4.1 while matlab needs the 2.4.0 and everythng broke again. Tired of all these problems i decided to opt for the dockerized version, i downloded the official ubuntu 24.04 docker from the docker hub and as said in the website i ran the following commands:
$ xhost +
$ docker run -it –rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro –shm-size=512M mathworks/matlab:r2025a
and the terminal is hanging and no interface is opening. I thought it might be a licencing problem but my licence is given from my university and i dont know how to retreive the licence file. Can someone help me fix the problem (and identify it if its different from my suppositions)?
Also extra quick question, after solving this problem how do i download add-ons and libs? Same as in the desktop version?
Thanks in advance :)Hi everyone
I am a linux user and i have an arch installation running with X11 desktop management on my pc. I always struggled to run matlab on my laptop (interface wont open and stuff like that) since arch is not officially supported and i deferred to using the online version. After a bit i fixed the problems and started using the desktop version without issue up untill the last month when the glibc packag updated to the 2.4.1 while matlab needs the 2.4.0 and everythng broke again. Tired of all these problems i decided to opt for the dockerized version, i downloded the official ubuntu 24.04 docker from the docker hub and as said in the website i ran the following commands:
$ xhost +
$ docker run -it –rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro –shm-size=512M mathworks/matlab:r2025a
and the terminal is hanging and no interface is opening. I thought it might be a licencing problem but my licence is given from my university and i dont know how to retreive the licence file. Can someone help me fix the problem (and identify it if its different from my suppositions)?
Also extra quick question, after solving this problem how do i download add-ons and libs? Same as in the desktop version?
Thanks in advance 🙂 Hi everyone
I am a linux user and i have an arch installation running with X11 desktop management on my pc. I always struggled to run matlab on my laptop (interface wont open and stuff like that) since arch is not officially supported and i deferred to using the online version. After a bit i fixed the problems and started using the desktop version without issue up untill the last month when the glibc packag updated to the 2.4.1 while matlab needs the 2.4.0 and everythng broke again. Tired of all these problems i decided to opt for the dockerized version, i downloded the official ubuntu 24.04 docker from the docker hub and as said in the website i ran the following commands:
$ xhost +
$ docker run -it –rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro –shm-size=512M mathworks/matlab:r2025a
and the terminal is hanging and no interface is opening. I thought it might be a licencing problem but my licence is given from my university and i dont know how to retreive the licence file. Can someone help me fix the problem (and identify it if its different from my suppositions)?
Also extra quick question, after solving this problem how do i download add-ons and libs? Same as in the desktop version?
Thanks in advance 🙂 docker, matlab, linux MATLAB Answers — New Questions

​

Why Doesn’t “clear all” Clear the Assumptions from the Symbolic Engine?
Matlab News

Why Doesn’t “clear all” Clear the Assumptions from the Symbolic Engine?

PuTI / 2025-06-07

According to the doc page assumptions
To clear all objects in the MATLAB workspace and close the Symbolic Math Toolbox™ engine associated with the MATLAB workspace resetting all its assumptions, use this command
clear all
Comment: I think the doc page would be clearer if that clause replaced "resetting" with "clearing".
But
syms x
assume(x < 1)
assumptions
clear all
assumptions
I’m quite certain that in previous versions (like 2022a?) the command "clear all" did clear the assumptions from the engine.
Is this a relatively-newly-introduced bug or am I misremembering/misunderstanding the situation?
Answers is running 2024b, I see the same behavior on 2024a.According to the doc page assumptions
To clear all objects in the MATLAB workspace and close the Symbolic Math Toolbox™ engine associated with the MATLAB workspace resetting all its assumptions, use this command
clear all
Comment: I think the doc page would be clearer if that clause replaced "resetting" with "clearing".
But
syms x
assume(x < 1)
assumptions
clear all
assumptions
I’m quite certain that in previous versions (like 2022a?) the command "clear all" did clear the assumptions from the engine.
Is this a relatively-newly-introduced bug or am I misremembering/misunderstanding the situation?
Answers is running 2024b, I see the same behavior on 2024a. According to the doc page assumptions
To clear all objects in the MATLAB workspace and close the Symbolic Math Toolbox™ engine associated with the MATLAB workspace resetting all its assumptions, use this command
clear all
Comment: I think the doc page would be clearer if that clause replaced "resetting" with "clearing".
But
syms x
assume(x < 1)
assumptions
clear all
assumptions
I’m quite certain that in previous versions (like 2022a?) the command "clear all" did clear the assumptions from the engine.
Is this a relatively-newly-introduced bug or am I misremembering/misunderstanding the situation?
Answers is running 2024b, I see the same behavior on 2024a. asusmptions, clear MATLAB Answers — New Questions

​

How to save (serialize) MATLAB variables to a byte string?
Matlab News

How to save (serialize) MATLAB variables to a byte string?

PuTI / 2025-06-06

Ideally this would be using the same format as the save command (.mat file), but instead of writing to disk directly, it would write it to data in memory.
The reason is I need to access the saved data directly to implement a custom hashing method on the variable, and have no need to write it to disk in order to achieve this, and would rather not go through the administratively-heavy option of creating a ram disk through ramfs.
I’d actually be OK with a version-change of MATLAB invalidating the object in my particular case (the idea being that any software updates may influence results, however unlikely).
Assuming full .mat support is not an option, I still need fairly general support, which is why the (intermediate) output of save seems like a good option: e.g., nested structs, cells, arrays. I could probably do without Java objects in this particular case.Ideally this would be using the same format as the save command (.mat file), but instead of writing to disk directly, it would write it to data in memory.
The reason is I need to access the saved data directly to implement a custom hashing method on the variable, and have no need to write it to disk in order to achieve this, and would rather not go through the administratively-heavy option of creating a ram disk through ramfs.
I’d actually be OK with a version-change of MATLAB invalidating the object in my particular case (the idea being that any software updates may influence results, however unlikely).
Assuming full .mat support is not an option, I still need fairly general support, which is why the (intermediate) output of save seems like a good option: e.g., nested structs, cells, arrays. I could probably do without Java objects in this particular case. Ideally this would be using the same format as the save command (.mat file), but instead of writing to disk directly, it would write it to data in memory.
The reason is I need to access the saved data directly to implement a custom hashing method on the variable, and have no need to write it to disk in order to achieve this, and would rather not go through the administratively-heavy option of creating a ram disk through ramfs.
I’d actually be OK with a version-change of MATLAB invalidating the object in my particular case (the idea being that any software updates may influence results, however unlikely).
Assuming full .mat support is not an option, I still need fairly general support, which is why the (intermediate) output of save seems like a good option: e.g., nested structs, cells, arrays. I could probably do without Java objects in this particular case. save, serialization, pickling, hashing, undocumented, serialize MATLAB Answers — New Questions

​

Cannot set text to UIaxes because cannot set position since xaxis is made of datetime
Matlab News

Cannot set text to UIaxes because cannot set position since xaxis is made of datetime

PuTI / 2025-06-06

I have an application that plots time against pressure values. Time is of the format datetime. I plot using these lines of code.
plot(app.UIAxes_9,pressureTime,Pressure);
app.UIAxes_9.XGrid ="on";
app.UIAxes_9.XMinorGrid ="on";
app.UIAxes_9.YGrid ="on";
app.UIAxes_9.YMinorGrid ="on";
app.UIAxes_9.LineWidth = 2;
app.UIAxes_9.XLabel.String = ‘Time&Date’;
app.UIAxes_9.XLabel.FontSize = 12;
app.UIAxes_9.XLabel.FontWeight ="bold";
app.UIAxes_9.YLabel.String = ‘Pressure[bar]’;
app.UIAxes_9.YLabel.FontSize = 12;
app.UIAxes_9.YLabel.FontWeight ="bold";
app.UIAxes_9.Title.String = ‘Pressure Cycle’;
app.UIAxes_9.Title.FontSize = 14;
app.UIAxes_9.Title.FontWeight ="bold";
[maxValue, maxIndex] = max(Pressure);
maxY = Pressure(maxIndex);
maxX = pressureTime(maxIndex);
text1 = ‘Max Pressure[bar]: ‘;
text2 = num2str(maxValue);
finalText = strcat(text1,text2);
text(‘Parent’,app.UIAxes_9,’String’,finalText,’HorizontalAlignment’, ‘left’,’VerticalAlignment’,’bottom’,’Position’,[maxX maxY]);
The problem is the last line, where I tried to put a text on the UIAxes. That is
text(‘Parent’,app.UIAxes_9,’String’,finalText,’HorizontalAlignment’, ‘left’,’VerticalAlignment’,’bottom’,’Position’,[maxX maxY]);
where I tried to set the position of the text at maxX and maxY. But [maxX maxY] is giving me an error :
Error using datetime/horzcat (line 1468)
All inputs must be datetimes or date/time character vectors or date/time strings.
So what I understood is you cant combine a double and datetime to form an array. So how can I do this for a app.UIaxes. For a normal plot it is easy, but here I need for app.UIaxes. How to do this. Thank you.I have an application that plots time against pressure values. Time is of the format datetime. I plot using these lines of code.
plot(app.UIAxes_9,pressureTime,Pressure);
app.UIAxes_9.XGrid ="on";
app.UIAxes_9.XMinorGrid ="on";
app.UIAxes_9.YGrid ="on";
app.UIAxes_9.YMinorGrid ="on";
app.UIAxes_9.LineWidth = 2;
app.UIAxes_9.XLabel.String = ‘Time&Date’;
app.UIAxes_9.XLabel.FontSize = 12;
app.UIAxes_9.XLabel.FontWeight ="bold";
app.UIAxes_9.YLabel.String = ‘Pressure[bar]’;
app.UIAxes_9.YLabel.FontSize = 12;
app.UIAxes_9.YLabel.FontWeight ="bold";
app.UIAxes_9.Title.String = ‘Pressure Cycle’;
app.UIAxes_9.Title.FontSize = 14;
app.UIAxes_9.Title.FontWeight ="bold";
[maxValue, maxIndex] = max(Pressure);
maxY = Pressure(maxIndex);
maxX = pressureTime(maxIndex);
text1 = ‘Max Pressure[bar]: ‘;
text2 = num2str(maxValue);
finalText = strcat(text1,text2);
text(‘Parent’,app.UIAxes_9,’String’,finalText,’HorizontalAlignment’, ‘left’,’VerticalAlignment’,’bottom’,’Position’,[maxX maxY]);
The problem is the last line, where I tried to put a text on the UIAxes. That is
text(‘Parent’,app.UIAxes_9,’String’,finalText,’HorizontalAlignment’, ‘left’,’VerticalAlignment’,’bottom’,’Position’,[maxX maxY]);
where I tried to set the position of the text at maxX and maxY. But [maxX maxY] is giving me an error :
Error using datetime/horzcat (line 1468)
All inputs must be datetimes or date/time character vectors or date/time strings.
So what I understood is you cant combine a double and datetime to form an array. So how can I do this for a app.UIaxes. For a normal plot it is easy, but here I need for app.UIaxes. How to do this. Thank you. I have an application that plots time against pressure values. Time is of the format datetime. I plot using these lines of code.
plot(app.UIAxes_9,pressureTime,Pressure);
app.UIAxes_9.XGrid ="on";
app.UIAxes_9.XMinorGrid ="on";
app.UIAxes_9.YGrid ="on";
app.UIAxes_9.YMinorGrid ="on";
app.UIAxes_9.LineWidth = 2;
app.UIAxes_9.XLabel.String = ‘Time&Date’;
app.UIAxes_9.XLabel.FontSize = 12;
app.UIAxes_9.XLabel.FontWeight ="bold";
app.UIAxes_9.YLabel.String = ‘Pressure[bar]’;
app.UIAxes_9.YLabel.FontSize = 12;
app.UIAxes_9.YLabel.FontWeight ="bold";
app.UIAxes_9.Title.String = ‘Pressure Cycle’;
app.UIAxes_9.Title.FontSize = 14;
app.UIAxes_9.Title.FontWeight ="bold";
[maxValue, maxIndex] = max(Pressure);
maxY = Pressure(maxIndex);
maxX = pressureTime(maxIndex);
text1 = ‘Max Pressure[bar]: ‘;
text2 = num2str(maxValue);
finalText = strcat(text1,text2);
text(‘Parent’,app.UIAxes_9,’String’,finalText,’HorizontalAlignment’, ‘left’,’VerticalAlignment’,’bottom’,’Position’,[maxX maxY]);
The problem is the last line, where I tried to put a text on the UIAxes. That is
text(‘Parent’,app.UIAxes_9,’String’,finalText,’HorizontalAlignment’, ‘left’,’VerticalAlignment’,’bottom’,’Position’,[maxX maxY]);
where I tried to set the position of the text at maxX and maxY. But [maxX maxY] is giving me an error :
Error using datetime/horzcat (line 1468)
All inputs must be datetimes or date/time character vectors or date/time strings.
So what I understood is you cant combine a double and datetime to form an array. So how can I do this for a app.UIaxes. For a normal plot it is easy, but here I need for app.UIaxes. How to do this. Thank you. matlab, appdesigner MATLAB Answers — New Questions

​

How do I locate the crash dump files generated by MATLAB?
Matlab News

How do I locate the crash dump files generated by MATLAB?

PuTI / 2025-06-06

MATLAB encountered a crash. How do I locate the crash log files on my computer. MATLAB encountered a crash. How do I locate the crash log files on my computer.  MATLAB encountered a crash. How do I locate the crash log files on my computer.   MATLAB Answers — New Questions

​

Why does MATLAB Production Server (MPS) take more time to process the first request compared to the subsequent requests?
Matlab News

Why does MATLAB Production Server (MPS) take more time to process the first request compared to the subsequent requests?

PuTI / 2025-06-06

When I send my first request to the MATLAB Production Server in MATLAB R2019a, it takes ~30 seconds to process it. However, the subsequent requests take less than a second to process. Why is this behavior encountered?When I send my first request to the MATLAB Production Server in MATLAB R2019a, it takes ~30 seconds to process it. However, the subsequent requests take less than a second to process. Why is this behavior encountered? When I send my first request to the MATLAB Production Server in MATLAB R2019a, it takes ~30 seconds to process it. However, the subsequent requests take less than a second to process. Why is this behavior encountered? mps, process, workers, startup MATLAB Answers — New Questions

​

Control of dehumidifier with system level heat exchanger
Matlab News

Control of dehumidifier with system level heat exchanger

PuTI / 2025-06-06

Hey guys,
i’m trying to add controls to the attached model. I’d like to control the flow-rate of the 2 flow-rate-sources in order to change the heat/cold transfered to the MA-Network. When doing so manually there’s not the change i expected, so i figured, that i also need to change the nominal rate of heat-transfer of the system-level-heat-exchanger accordingly to the flow-rate. Also when the flow-rate is too low, i get an error. I assume it’s because the model thinks of the rate of heat-transfer as constant, so by chaning the flow-rate deltaT becomes incredibly high.
I tried to do so with a Matlab script, that influenced the parameters over time. But the graphs showed me this doesn’t work like inteded. And i’ve found this, saying basicly it’s not possible to add the controls i had in mind, am i wrong?
https://de.mathworks.com/help/simscape/ug/how-simscape-run-time-parameters-differs-from-simulink.html

Can somebody help me please? Maybe i’m just not seeing the obvious solution here 😀

Cheers,Hey guys,
i’m trying to add controls to the attached model. I’d like to control the flow-rate of the 2 flow-rate-sources in order to change the heat/cold transfered to the MA-Network. When doing so manually there’s not the change i expected, so i figured, that i also need to change the nominal rate of heat-transfer of the system-level-heat-exchanger accordingly to the flow-rate. Also when the flow-rate is too low, i get an error. I assume it’s because the model thinks of the rate of heat-transfer as constant, so by chaning the flow-rate deltaT becomes incredibly high.
I tried to do so with a Matlab script, that influenced the parameters over time. But the graphs showed me this doesn’t work like inteded. And i’ve found this, saying basicly it’s not possible to add the controls i had in mind, am i wrong?
https://de.mathworks.com/help/simscape/ug/how-simscape-run-time-parameters-differs-from-simulink.html

Can somebody help me please? Maybe i’m just not seeing the obvious solution here 😀

Cheers, Hey guys,
i’m trying to add controls to the attached model. I’d like to control the flow-rate of the 2 flow-rate-sources in order to change the heat/cold transfered to the MA-Network. When doing so manually there’s not the change i expected, so i figured, that i also need to change the nominal rate of heat-transfer of the system-level-heat-exchanger accordingly to the flow-rate. Also when the flow-rate is too low, i get an error. I assume it’s because the model thinks of the rate of heat-transfer as constant, so by chaning the flow-rate deltaT becomes incredibly high.
I tried to do so with a Matlab script, that influenced the parameters over time. But the graphs showed me this doesn’t work like inteded. And i’ve found this, saying basicly it’s not possible to add the controls i had in mind, am i wrong?
https://de.mathworks.com/help/simscape/ug/how-simscape-run-time-parameters-differs-from-simulink.html

Can somebody help me please? Maybe i’m just not seeing the obvious solution here 😀

Cheers, simscape, simulink, heatexchanger, fluids MATLAB Answers — New Questions

​

RF Data Converter: input/output data types
Matlab News

RF Data Converter: input/output data types

PuTI / 2025-06-05

Dear all,

I am using the SoC Blockset add-on to create a design for ZCU111 evaluation board.

1) The RF Data converter block accepts only int16/uint16 at adcTxChy inport. How does it determine the amplitude of the received signal when deployed on hardware? Or, to put question differently, which amplitudes of the received signal are converted to which uint16 instances? Am I correct, that in the simulation it does not matter what the amplitude of the signal is – it receives and passes raw bits?
2) The output adcTxChyData of RFDC can be of types uint16 | uint32 | uint64 | fixed point. I am curious about in which cases it is a fixed point datatype? Does the amplitude of the received signal equal real world value of this fixed point data type when deployed on hardware?

Thank you!Dear all,

I am using the SoC Blockset add-on to create a design for ZCU111 evaluation board.

1) The RF Data converter block accepts only int16/uint16 at adcTxChy inport. How does it determine the amplitude of the received signal when deployed on hardware? Or, to put question differently, which amplitudes of the received signal are converted to which uint16 instances? Am I correct, that in the simulation it does not matter what the amplitude of the signal is – it receives and passes raw bits?
2) The output adcTxChyData of RFDC can be of types uint16 | uint32 | uint64 | fixed point. I am curious about in which cases it is a fixed point datatype? Does the amplitude of the received signal equal real world value of this fixed point data type when deployed on hardware?

Thank you! Dear all,

I am using the SoC Blockset add-on to create a design for ZCU111 evaluation board.

1) The RF Data converter block accepts only int16/uint16 at adcTxChy inport. How does it determine the amplitude of the received signal when deployed on hardware? Or, to put question differently, which amplitudes of the received signal are converted to which uint16 instances? Am I correct, that in the simulation it does not matter what the amplitude of the signal is – it receives and passes raw bits?
2) The output adcTxChyData of RFDC can be of types uint16 | uint32 | uint64 | fixed point. I am curious about in which cases it is a fixed point datatype? Does the amplitude of the received signal equal real world value of this fixed point data type when deployed on hardware?

Thank you! fixed-point, soc blockset, simulink, datatypes, rf data converter, rfdc, adc MATLAB Answers — New Questions

​

Discrete Phasor domain in Simscape
Matlab News

Discrete Phasor domain in Simscape

PuTI / 2025-06-05

Dear community,
Is it possible to create an electrical model using Simscape blocks (blue ones) and solve it in Discrete Phasor domain, i.e. RMS quantities (as it can be done using Specialized Power Systems)?
If not, is there any other alternative?
Thank you very much in advance.
Best regards,
Víctor Sánchez SuárezDear community,
Is it possible to create an electrical model using Simscape blocks (blue ones) and solve it in Discrete Phasor domain, i.e. RMS quantities (as it can be done using Specialized Power Systems)?
If not, is there any other alternative?
Thank you very much in advance.
Best regards,
Víctor Sánchez Suárez Dear community,
Is it possible to create an electrical model using Simscape blocks (blue ones) and solve it in Discrete Phasor domain, i.e. RMS quantities (as it can be done using Specialized Power Systems)?
If not, is there any other alternative?
Thank you very much in advance.
Best regards,
Víctor Sánchez Suárez simscape, discrete phasor, rms, specialized power systems MATLAB Answers — New Questions

​

How do I exclude the first ten observations in the line plot generated by the three differential equations
Matlab News

How do I exclude the first ten observations in the line plot generated by the three differential equations

PuTI / 2025-06-05

close all
clear all
clc
tspan = [0 100];
y0 = 0.7; % initial value of state variable x1
r0 = 0.7; % initial value of state variable x2
w0 = 0.8; % initial value of state variable x3
x0 = [y0; r0; w0];
[t, x] = ode45(@odefcn, tspan, x0);

%% Plot x2 (y-axis) vs. x1 (x-axis)
subplot(3,1,1);
plot(t,x(:,1));
xlabel(‘Time’)
ylabel(‘Output’);
subplot(3,1,2);
plot(t,x(:,2));
xlabel(‘Time’)
ylabel(‘Policy Rate’);
subplot(3,1,3);
plot(t,x(:,3));
xlabel(‘Time’)
ylabel(‘Wage Share’);
y0 = [0.7; 0.7; 0.8];

%% System of three differential equations
function dx = odefcn(t, x)
% definitions
y = x(1);
r = x(2);
w = x(3);
% parameters
alpha = 1.0;
beta = 1.0;
gamma = 0.1;
delta = 0.3;
mu = 1.0;
lambda = 0.3;
theta = 0.1;
omega = 0.2;
% ODEs
dx(1,1) = alpha * y – beta * r * y;
dx(2,1) = – omega * r + gamma * w * r + delta * y * r;
dx(3,1) = – theta * w + lambda * y * w – mu * w * w;
endclose all
clear all
clc
tspan = [0 100];
y0 = 0.7; % initial value of state variable x1
r0 = 0.7; % initial value of state variable x2
w0 = 0.8; % initial value of state variable x3
x0 = [y0; r0; w0];
[t, x] = ode45(@odefcn, tspan, x0);

%% Plot x2 (y-axis) vs. x1 (x-axis)
subplot(3,1,1);
plot(t,x(:,1));
xlabel(‘Time’)
ylabel(‘Output’);
subplot(3,1,2);
plot(t,x(:,2));
xlabel(‘Time’)
ylabel(‘Policy Rate’);
subplot(3,1,3);
plot(t,x(:,3));
xlabel(‘Time’)
ylabel(‘Wage Share’);
y0 = [0.7; 0.7; 0.8];

%% System of three differential equations
function dx = odefcn(t, x)
% definitions
y = x(1);
r = x(2);
w = x(3);
% parameters
alpha = 1.0;
beta = 1.0;
gamma = 0.1;
delta = 0.3;
mu = 1.0;
lambda = 0.3;
theta = 0.1;
omega = 0.2;
% ODEs
dx(1,1) = alpha * y – beta * r * y;
dx(2,1) = – omega * r + gamma * w * r + delta * y * r;
dx(3,1) = – theta * w + lambda * y * w – mu * w * w;
end close all
clear all
clc
tspan = [0 100];
y0 = 0.7; % initial value of state variable x1
r0 = 0.7; % initial value of state variable x2
w0 = 0.8; % initial value of state variable x3
x0 = [y0; r0; w0];
[t, x] = ode45(@odefcn, tspan, x0);

%% Plot x2 (y-axis) vs. x1 (x-axis)
subplot(3,1,1);
plot(t,x(:,1));
xlabel(‘Time’)
ylabel(‘Output’);
subplot(3,1,2);
plot(t,x(:,2));
xlabel(‘Time’)
ylabel(‘Policy Rate’);
subplot(3,1,3);
plot(t,x(:,3));
xlabel(‘Time’)
ylabel(‘Wage Share’);
y0 = [0.7; 0.7; 0.8];

%% System of three differential equations
function dx = odefcn(t, x)
% definitions
y = x(1);
r = x(2);
w = x(3);
% parameters
alpha = 1.0;
beta = 1.0;
gamma = 0.1;
delta = 0.3;
mu = 1.0;
lambda = 0.3;
theta = 0.1;
omega = 0.2;
% ODEs
dx(1,1) = alpha * y – beta * r * y;
dx(2,1) = – omega * r + gamma * w * r + delta * y * r;
dx(3,1) = – theta * w + lambda * y * w – mu * w * w;
end graphics, subplot, plotting, plot, differential equations MATLAB Answers — New Questions

​

Abfload error – colon operands must be real scalars
Matlab News

Abfload error – colon operands must be real scalars

PuTI / 2025-06-05

Hi all, we’ve had to transfer some Matlab code to a new computer for analysis of .abf files and moved from version R2018b to R2025a. However abfload is now giving us the error message below. Can anybody suggest a work around? The error message is below.

Error using :
Colon operands must be real scalars.
Error in
abfload (line 304)
h.protocolName=char(BigString(tmpIx1:tmpIx2(1)+3))’;
^Hi all, we’ve had to transfer some Matlab code to a new computer for analysis of .abf files and moved from version R2018b to R2025a. However abfload is now giving us the error message below. Can anybody suggest a work around? The error message is below.

Error using :
Colon operands must be real scalars.
Error in
abfload (line 304)
h.protocolName=char(BigString(tmpIx1:tmpIx2(1)+3))’;
^ Hi all, we’ve had to transfer some Matlab code to a new computer for analysis of .abf files and moved from version R2018b to R2025a. However abfload is now giving us the error message below. Can anybody suggest a work around? The error message is below.

Error using :
Colon operands must be real scalars.
Error in
abfload (line 304)
h.protocolName=char(BigString(tmpIx1:tmpIx2(1)+3))’;
^ abfload, colon operands MATLAB Answers — New Questions

​

Guideline for implementing PID and saturation
Matlab News

Guideline for implementing PID and saturation

PuTI / 2025-06-04

I have the following model where I have as a setpoint a step input with constant value 10 and stepme 0 and used initially a step input of value 600 in order to approximate an impulse; which are now the PID and saturation block guidelines in order to successfully track the setpoint (R=10)? How can I achieve an oscillating behaviour around the setpoint?I have the following model where I have as a setpoint a step input with constant value 10 and stepme 0 and used initially a step input of value 600 in order to approximate an impulse; which are now the PID and saturation block guidelines in order to successfully track the setpoint (R=10)? How can I achieve an oscillating behaviour around the setpoint? I have the following model where I have as a setpoint a step input with constant value 10 and stepme 0 and used initially a step input of value 600 in order to approximate an impulse; which are now the PID and saturation block guidelines in order to successfully track the setpoint (R=10)? How can I achieve an oscillating behaviour around the setpoint? pid, saturation MATLAB Answers — New Questions

​

Gap in the plot
Matlab News

Gap in the plot

PuTI / 2025-06-04

Hi,
I am given a contineuous water level data measured and measured cross section to calculate discharge by Manning equation. All these data were checked for gaps, and found contineuous. When running the following script the discharge having gaps, creats a jump which looks strange. Tried for several weeks to find it, but didn’t. Hope for your help.
%this script reads Cross and crocss-sections data from tributaries:
%Tzipori, Yiftachel, Tzvi, Oz, Mizra, Adashim, Taanach and Keini
%It 1. reads divers data 2. change them to be water level 3. calculate
%discharge.
%Discharge calculation requires:
%1. find the water level in the current time step 2. caculate discharge using manning
tic
clear all
close all

%%%%%%%%%%%% Part A: find water level of all sites%%%%%%%%%%%%%%%%%%%
% Get a list of all txt files in the current folder, or subfolders of it.

%Read discharge
lines1 = readlines("trib_names.txt");
trib_name=(categorical(lines1));

for i=1:length(trib_name)
trib1{i}=trib_name(i)
end

trib=string(trib1)+’level’; %for the case of water level;
cd ‘C:UsersuserDocumentsShulamitPhDMatlab_PhDHydrologyDischdivers’;
lvl=NaN(418907,16);%columns: longest diver data, rows/2= # of tributaries. each st. ha two columns: for date and data of stations
AllDivresfiles = natsortfiles(dir(‘*.txt’));

for k =1:size(AllDivresfiles,1)
% k=5%shut ‘end’ at the end of loop. Find thie in ‘kishon_catchment_discharge_calc_for1trib’
thisfilename1 = AllDivresfiles(k).name; %just the name
thisdata1 = load(thisfilename1); %load just this file
Lng_lvl(k)=length(thisdata1);
date1=x2mdate(thisdata1(:,1));
%plot(date1,thisdata1(:,2));ylabel(‘Level (cm)’)
num_days=length(unique(thisdata1(:,1)));
interval=720;%720 is the daily period of the time interval of data: 2 min. length(thisdata1(:,1))/(num_days*24);%Model has 1 hours intervals, so this is the interval obtained here. Obtain intervals according to 10 min intrval
baseP=min(thisdata1(:,2));%background pressure
curr_lvl1=(thisdata1(:,2)-baseP)/100;%units change to meter%for smoothing turn curr_lvl to curr_lvl1
curr_lvl=smoothdata(curr_lvl1,’movmean’,interval);
%curr_lvl=smoothdata(curr_lvl,’gaussian’,interval);
lvl(1:size(thisdata1,1),(2*k-1):2*k)=[date1 curr_lvl];%Removing diver’s bias (correct only forephemeral tributaries) and converting to m
lngt(k)=length(curr_lvl);
end

in0=find((lvl)==0);
lvl(in0)=NaN;
figure(‘Name’,’Adashim’);adash=lvl(:,1:2);plot(adash(:,1),adash(:,2));datetick;title=’Adashim lvl’;
figure(‘Name’,’Keini’);keini=lvl(:,3:4);plot(keini(:,1),keini(:,2));title=’Keini lvl’;datetick;
figure(‘Name’,’KishonMaale’);KishonMaale=lvl(:,5:6);plot(KishonMaale(:,1),KishonMaale(:,2));title=’KishonMaale lvl’;datetick
figure(‘Name’,’Mizra’);mizra=lvl(:,7:8);plot(mizra(:,1),mizra(:,2));title=’Mizra lvl’;datetick;
figure(‘Name’,’Oz’);oz=lvl(:,9:10);plot(oz(:,1),oz(:,2));title=’Oz lvl’;datetick;
figure(‘Name’,’Taanach’);taanach=lvl(:,11:12);plot(taanach(:,1),taanach(:,2));title=’Taanach lvl’;datetick;
figure(‘Name’,’Tzvi’);title=’Tzvi lvl’;tzvi=lvl(:,13:14);plot(tzvi(:,1),tzvi(:,2));datetick;
figure(‘Name’,’Yiftachel’);title=’Yiftachel lvl’;yiftachel=lvl(:,15:16);plot(yiftachel(:,1),yiftachel(:,2));title=’Yiftachel lvl’;datetick;

%%%%%%%%%%%% Part B: find cross section%%%%%%%%%%%%%%%%%%%
%Read cross sections. In most tributaries the divers are in the downstream
%All files with ‘1’ are upstrream and all with ‘2’ are downstreaצ. For example: OzUp=Oz1, OzDown=Oz2

trib=length(AllDivresfiles);
cd ‘C:UsersuserDocumentsShulamitPhDMatlab_PhDHydrologyDischcrossectionsDownstream’;
crs=NaN(max(lngt),5*trib);%columns: longest cross section data, rows-# of stations*5
AllCrossfiles = natsortfiles(dir(‘*.txt’));
min_for_slope1=NaN(trib,3);

%Collect all downstream crossection data together
for l = 1:length(AllCrossfiles)
%l=1 %shut ‘end’ at the end of loop
thisfilename2 = AllCrossfiles(l).name; %just the name
thisdata2 = load(thisfilename2); %load current file
crs(1:length(thisdata2),5*l-4:l*5)=thisdata2;
[MIN,I0]=min(thisdata2(:,3));%sea level elevation to have absolute elevation
min_for_slope1(l,:)=thisdata2(I0,1:3);%The slope is obtained by the slope bwtween two min of adjacent croo sections.
Lng(l)=length(thisdata2);
% figure(‘Name’,[char(trib_name(l)) ‘_crs_dn’])
% plot(crs(:,5*l-4),crs(:,5*l))
end

% adash1_crs=crs(:,4:5);keini1_crs=crs(:,9:10);mizra1_crs=crs(:,14:15);oz1_crs=crs(:,19:20);taanach1_crs=crs(:,24:25);tzvi1_crs=crs(:,29:30);yiftachel1_crs=crs(:,34:35);
% figure(11);plot(adash1_crs(:,1),adash1_crs(:,2));figure(22); plot(keini1_crs(:,1),keini1_crs(:,2));figure(33);plot(mizra1_crs(:,1),mizra1_crs(:,2));figure(44);plot(oz1_crs(:,1),oz1_crs(:,2));figure(55);plot(taanach1_crs(:,1),taanach1_crs(:,2));figure(66);plot(tzvi1_crs(:,1),tzvi1_crs(:,2));figure(77);plot(yiftachel1_crs(:,1),yiftachel1_crs(:,2));

%%%%% Part B1: Reading upstream for slope%%%%%%%%
min_for_slope2=NaN(trib,3);%coordinates (columns 1 and 2) and elevation (column3). of minimum in the cross sectioncolumns: longest diver data, rows/2= # of tributaries. each st. ha two columns: for date and data of stations
cd ‘C:UsersuserDocumentsShulamitPhDMatlab_PhDHydrologyDischcrossections’;

%min_for_slope=NaN(trib*2,2);%columns: longest cross section data, rows-# of stations
Allupstrmfiles = orderfields(dir(‘*.txt’));
for j = 1 : trib
upstrmName = Allupstrmfiles(j).name; %just the name; j or l
thisupstrm = load(upstrmName); %load just this file
[MIN1,I1]=min(thisupstrm(:,3));%Sea level to get absolute elevation
min_for_slope2(j,:)=(thisupstrm(I1,1:3));
% figure(‘Name’,[char(trib_name(j)) ‘_crs_up’])
% plot(thisupstrm(:,4),thisupstrm(:,3))
end

%%%%%%%%%%%%%%%%NEW 29052025%%%%%%%%%%%%%%%%%%%%%%%%%%%
all_lvl=NaN(max(lngt),trib);
discharge_all=NaN(418907,trib*2);%longest data
discharge=NaN(418907,2);
g=0;
f=0;

for t=1:trib
x=crs(1:Lng(t),5*t-4);
y=crs(1:Lng(t),5*t-3);
crsc=crs(1:Lng(t),5*t);
x0=x(1);y0=y(1);
distance1=((x-x0).^2+(y-y0).^2).^(1/2);%crs(1:Lng(t),5*t-1);
%Interpolation to create smoother discharge calculation
DF=abs(min(crsc(1:length(crsc)-1)-crsc(2:length(crsc))))/300;%Order of magnitude of distance difference and elveation are similar
basic_distance=distance1(1):DF:distance1(end);
distance11=1:(length(crsc));
distance=interp1(distance11,distance1,basic_distance);%to do interpolation to distance , since t is not a stright line
smth_crs=interp1(distance1,crsc,distance);
% smth_x=interp1(distance1,x,distance);
% smth_y=interp1(distance1,y,distance);

for m=1:Lng_lvl(t)%m=233648

if isnan(lvl(m,2*t))
discharge(m,1:2)=[lvl(m,2*t-1) NaN];
f=f+1;
continue
end

[M lvl_ind1]=min(abs(lvl(m,2*t)-smth_crs));%Find current water level in lvl and the current cross section

if smth_crs(lvl_ind1)==min(smth_crs)
discharge(m,1:2)=[lvl(m,2*t-1) 0];
g=g+1;
continue
end

lvl_ind2=find(smth_crs<=smth_crs(lvl_ind1));
distance2=distance(lvl_ind2);smth_crs2=smth_crs(lvl_ind2);
P1=((distance2(2:end)-distance2(1:end-1)).^2+(smth_crs2(2:end)-smth_crs2(1:end-1)).^2).^(1/2);
% lvl_ind2=find(smth_crs<=smth_crs(lvl_ind1));
% lvl_ind22=crsc<=min(crsc);
% crsc_lvl=crsc(lvl_ind22);
% x_lvl=x(lvl_ind22);%Due to wetted perimeter.
% y_lvl=y(lvl_ind22);%Due to wetted perimeter.
% % smth_x_lvl=smth_x(lvl_ind2);%Due to wetted perimeter.
% % smth_y_lvl=smth_y(lvl_ind2);%Due to wetted perimeter.
% smth_crs_lvl=smth_crs(lvl_ind2);%Due to wetted perimeter.

%Wetted perimeter:
% P1=((x_lvl(2:end)-x_lvl(1:end-1)).^2+(y_lvl(2:end)-y_lvl(1:end-1)).^2+(crsc_lvl(2:end)-crsc_lvl(1:end-1)).^2).^(1/2);
P(m)=sum(P1);

if isnan(P(m))
discharge(m,1:2)=[lvl(m,2*t-1) 0];
q=q+1;
continue
end

%Slope
dx = min_for_slope2(t,1) – min_for_slope1(t,1);
dy = min_for_slope2(t,2) – min_for_slope1(t,2);
dz(t) = min_for_slope2(t,3) – min_for_slope1(t,3);
distance3D = sqrt(dx^2 + dy^2 + dz(t)^2);
S(t) = abs(dz(t)) / distance3D;
% S(t)=min_for_slope2(t,3)-min_for_slope1(t,3)/(min_for_slope2(t,1)-min_for_slope1(t,1))^2+(min_for_slope2(t,2)-min_for_slope1(t,2))^2+…
% (min_for_slope2(t,3)-min_for_slope1(t,3))^2;%Slope. Constant for crossection

%Area
A(m) = trapz(distance(lvl_ind2), smth_crs(lvl_ind1) – smth_crs(lvl_ind2)); % assumes smth_crs is bed elevation
%A(m)=trapz(distance-smth_crs);
R(m)=A(m)/P(m);%Hydraulic radius;

%Manning
%Effect of water level on n of Manning:

if smth_crs(lvl_ind1) < 0.3
N = 0.1;
elseif and(smth_crs(lvl_ind1) >= 0.3, smth_crs(lvl_ind1) < 0.7)
N = 0.06;
else
N = 0.03;
end

discharge1=(A(m)*(1/N)*R(m)^(2/3))*S(t)^(1/2);
discharge(m,1:2)=[lvl(m,2*t-1) discharge1];

end%end ‘for m=…’
% figure(‘Name’,[char(trib_name(t)) ‘_smth_crs’])
% plot(smth_crs)

discharge_all(1:size(discharge,1),2*t-1:2*t)=discharge;
% [discharge2,ia,~] = unique(discharge1(:,2));
% discharge=[lvl(ia,2*t-1) discharge2];
% discharge_all(1:size(discharge,1),2*t-1:2*t)=discharge;

% plot(date1,discharge_all);
n=t;
discharge_all(1:length(discharge),2*n-1:2*n)=discharge;
% figure(n)
% plot(discharge_all(1:Lng_lvl(n),2*n-1),discharge_all(1:Lng_lvl(n),2*n))
% title=trib_name(n);
% ylabel(‘Q (m^3/s)’)
% datetick

figure(‘name’,char(trib_name(t)))
plot(lvl(:,2*t-1),discharge_all(:,2*t),’.’)
%title(names(t));
ylabel(‘Q (m^3/s)’)
datetick
end

%end %end for t=, m=…
discharge_all_smth=discharge_all;
filename = ‘C:UsersuserDocumentsShulamitPhDMatlab_PhDHydrologyDischdischarge_all_smth.mat’;
save( filename, ‘discharge_all_smth’ );
tocHi,
I am given a contineuous water level data measured and measured cross section to calculate discharge by Manning equation. All these data were checked for gaps, and found contineuous. When running the following script the discharge having gaps, creats a jump which looks strange. Tried for several weeks to find it, but didn’t. Hope for your help.
%this script reads Cross and crocss-sections data from tributaries:
%Tzipori, Yiftachel, Tzvi, Oz, Mizra, Adashim, Taanach and Keini
%It 1. reads divers data 2. change them to be water level 3. calculate
%discharge.
%Discharge calculation requires:
%1. find the water level in the current time step 2. caculate discharge using manning
tic
clear all
close all

%%%%%%%%%%%% Part A: find water level of all sites%%%%%%%%%%%%%%%%%%%
% Get a list of all txt files in the current folder, or subfolders of it.

%Read discharge
lines1 = readlines("trib_names.txt");
trib_name=(categorical(lines1));

for i=1:length(trib_name)
trib1{i}=trib_name(i)
end

trib=string(trib1)+’level’; %for the case of water level;
cd ‘C:UsersuserDocumentsShulamitPhDMatlab_PhDHydrologyDischdivers’;
lvl=NaN(418907,16);%columns: longest diver data, rows/2= # of tributaries. each st. ha two columns: for date and data of stations
AllDivresfiles = natsortfiles(dir(‘*.txt’));

for k =1:size(AllDivresfiles,1)
% k=5%shut ‘end’ at the end of loop. Find thie in ‘kishon_catchment_discharge_calc_for1trib’
thisfilename1 = AllDivresfiles(k).name; %just the name
thisdata1 = load(thisfilename1); %load just this file
Lng_lvl(k)=length(thisdata1);
date1=x2mdate(thisdata1(:,1));
%plot(date1,thisdata1(:,2));ylabel(‘Level (cm)’)
num_days=length(unique(thisdata1(:,1)));
interval=720;%720 is the daily period of the time interval of data: 2 min. length(thisdata1(:,1))/(num_days*24);%Model has 1 hours intervals, so this is the interval obtained here. Obtain intervals according to 10 min intrval
baseP=min(thisdata1(:,2));%background pressure
curr_lvl1=(thisdata1(:,2)-baseP)/100;%units change to meter%for smoothing turn curr_lvl to curr_lvl1
curr_lvl=smoothdata(curr_lvl1,’movmean’,interval);
%curr_lvl=smoothdata(curr_lvl,’gaussian’,interval);
lvl(1:size(thisdata1,1),(2*k-1):2*k)=[date1 curr_lvl];%Removing diver’s bias (correct only forephemeral tributaries) and converting to m
lngt(k)=length(curr_lvl);
end

in0=find((lvl)==0);
lvl(in0)=NaN;
figure(‘Name’,’Adashim’);adash=lvl(:,1:2);plot(adash(:,1),adash(:,2));datetick;title=’Adashim lvl’;
figure(‘Name’,’Keini’);keini=lvl(:,3:4);plot(keini(:,1),keini(:,2));title=’Keini lvl’;datetick;
figure(‘Name’,’KishonMaale’);KishonMaale=lvl(:,5:6);plot(KishonMaale(:,1),KishonMaale(:,2));title=’KishonMaale lvl’;datetick
figure(‘Name’,’Mizra’);mizra=lvl(:,7:8);plot(mizra(:,1),mizra(:,2));title=’Mizra lvl’;datetick;
figure(‘Name’,’Oz’);oz=lvl(:,9:10);plot(oz(:,1),oz(:,2));title=’Oz lvl’;datetick;
figure(‘Name’,’Taanach’);taanach=lvl(:,11:12);plot(taanach(:,1),taanach(:,2));title=’Taanach lvl’;datetick;
figure(‘Name’,’Tzvi’);title=’Tzvi lvl’;tzvi=lvl(:,13:14);plot(tzvi(:,1),tzvi(:,2));datetick;
figure(‘Name’,’Yiftachel’);title=’Yiftachel lvl’;yiftachel=lvl(:,15:16);plot(yiftachel(:,1),yiftachel(:,2));title=’Yiftachel lvl’;datetick;

%%%%%%%%%%%% Part B: find cross section%%%%%%%%%%%%%%%%%%%
%Read cross sections. In most tributaries the divers are in the downstream
%All files with ‘1’ are upstrream and all with ‘2’ are downstreaצ. For example: OzUp=Oz1, OzDown=Oz2

trib=length(AllDivresfiles);
cd ‘C:UsersuserDocumentsShulamitPhDMatlab_PhDHydrologyDischcrossectionsDownstream’;
crs=NaN(max(lngt),5*trib);%columns: longest cross section data, rows-# of stations*5
AllCrossfiles = natsortfiles(dir(‘*.txt’));
min_for_slope1=NaN(trib,3);

%Collect all downstream crossection data together
for l = 1:length(AllCrossfiles)
%l=1 %shut ‘end’ at the end of loop
thisfilename2 = AllCrossfiles(l).name; %just the name
thisdata2 = load(thisfilename2); %load current file
crs(1:length(thisdata2),5*l-4:l*5)=thisdata2;
[MIN,I0]=min(thisdata2(:,3));%sea level elevation to have absolute elevation
min_for_slope1(l,:)=thisdata2(I0,1:3);%The slope is obtained by the slope bwtween two min of adjacent croo sections.
Lng(l)=length(thisdata2);
% figure(‘Name’,[char(trib_name(l)) ‘_crs_dn’])
% plot(crs(:,5*l-4),crs(:,5*l))
end

% adash1_crs=crs(:,4:5);keini1_crs=crs(:,9:10);mizra1_crs=crs(:,14:15);oz1_crs=crs(:,19:20);taanach1_crs=crs(:,24:25);tzvi1_crs=crs(:,29:30);yiftachel1_crs=crs(:,34:35);
% figure(11);plot(adash1_crs(:,1),adash1_crs(:,2));figure(22); plot(keini1_crs(:,1),keini1_crs(:,2));figure(33);plot(mizra1_crs(:,1),mizra1_crs(:,2));figure(44);plot(oz1_crs(:,1),oz1_crs(:,2));figure(55);plot(taanach1_crs(:,1),taanach1_crs(:,2));figure(66);plot(tzvi1_crs(:,1),tzvi1_crs(:,2));figure(77);plot(yiftachel1_crs(:,1),yiftachel1_crs(:,2));

%%%%% Part B1: Reading upstream for slope%%%%%%%%
min_for_slope2=NaN(trib,3);%coordinates (columns 1 and 2) and elevation (column3). of minimum in the cross sectioncolumns: longest diver data, rows/2= # of tributaries. each st. ha two columns: for date and data of stations
cd ‘C:UsersuserDocumentsShulamitPhDMatlab_PhDHydrologyDischcrossections’;

%min_for_slope=NaN(trib*2,2);%columns: longest cross section data, rows-# of stations
Allupstrmfiles = orderfields(dir(‘*.txt’));
for j = 1 : trib
upstrmName = Allupstrmfiles(j).name; %just the name; j or l
thisupstrm = load(upstrmName); %load just this file
[MIN1,I1]=min(thisupstrm(:,3));%Sea level to get absolute elevation
min_for_slope2(j,:)=(thisupstrm(I1,1:3));
% figure(‘Name’,[char(trib_name(j)) ‘_crs_up’])
% plot(thisupstrm(:,4),thisupstrm(:,3))
end

%%%%%%%%%%%%%%%%NEW 29052025%%%%%%%%%%%%%%%%%%%%%%%%%%%
all_lvl=NaN(max(lngt),trib);
discharge_all=NaN(418907,trib*2);%longest data
discharge=NaN(418907,2);
g=0;
f=0;

for t=1:trib
x=crs(1:Lng(t),5*t-4);
y=crs(1:Lng(t),5*t-3);
crsc=crs(1:Lng(t),5*t);
x0=x(1);y0=y(1);
distance1=((x-x0).^2+(y-y0).^2).^(1/2);%crs(1:Lng(t),5*t-1);
%Interpolation to create smoother discharge calculation
DF=abs(min(crsc(1:length(crsc)-1)-crsc(2:length(crsc))))/300;%Order of magnitude of distance difference and elveation are similar
basic_distance=distance1(1):DF:distance1(end);
distance11=1:(length(crsc));
distance=interp1(distance11,distance1,basic_distance);%to do interpolation to distance , since t is not a stright line
smth_crs=interp1(distance1,crsc,distance);
% smth_x=interp1(distance1,x,distance);
% smth_y=interp1(distance1,y,distance);

for m=1:Lng_lvl(t)%m=233648

if isnan(lvl(m,2*t))
discharge(m,1:2)=[lvl(m,2*t-1) NaN];
f=f+1;
continue
end

[M lvl_ind1]=min(abs(lvl(m,2*t)-smth_crs));%Find current water level in lvl and the current cross section

if smth_crs(lvl_ind1)==min(smth_crs)
discharge(m,1:2)=[lvl(m,2*t-1) 0];
g=g+1;
continue
end

lvl_ind2=find(smth_crs<=smth_crs(lvl_ind1));
distance2=distance(lvl_ind2);smth_crs2=smth_crs(lvl_ind2);
P1=((distance2(2:end)-distance2(1:end-1)).^2+(smth_crs2(2:end)-smth_crs2(1:end-1)).^2).^(1/2);
% lvl_ind2=find(smth_crs<=smth_crs(lvl_ind1));
% lvl_ind22=crsc<=min(crsc);
% crsc_lvl=crsc(lvl_ind22);
% x_lvl=x(lvl_ind22);%Due to wetted perimeter.
% y_lvl=y(lvl_ind22);%Due to wetted perimeter.
% % smth_x_lvl=smth_x(lvl_ind2);%Due to wetted perimeter.
% % smth_y_lvl=smth_y(lvl_ind2);%Due to wetted perimeter.
% smth_crs_lvl=smth_crs(lvl_ind2);%Due to wetted perimeter.

%Wetted perimeter:
% P1=((x_lvl(2:end)-x_lvl(1:end-1)).^2+(y_lvl(2:end)-y_lvl(1:end-1)).^2+(crsc_lvl(2:end)-crsc_lvl(1:end-1)).^2).^(1/2);
P(m)=sum(P1);

if isnan(P(m))
discharge(m,1:2)=[lvl(m,2*t-1) 0];
q=q+1;
continue
end

%Slope
dx = min_for_slope2(t,1) – min_for_slope1(t,1);
dy = min_for_slope2(t,2) – min_for_slope1(t,2);
dz(t) = min_for_slope2(t,3) – min_for_slope1(t,3);
distance3D = sqrt(dx^2 + dy^2 + dz(t)^2);
S(t) = abs(dz(t)) / distance3D;
% S(t)=min_for_slope2(t,3)-min_for_slope1(t,3)/(min_for_slope2(t,1)-min_for_slope1(t,1))^2+(min_for_slope2(t,2)-min_for_slope1(t,2))^2+…
% (min_for_slope2(t,3)-min_for_slope1(t,3))^2;%Slope. Constant for crossection

%Area
A(m) = trapz(distance(lvl_ind2), smth_crs(lvl_ind1) – smth_crs(lvl_ind2)); % assumes smth_crs is bed elevation
%A(m)=trapz(distance-smth_crs);
R(m)=A(m)/P(m);%Hydraulic radius;

%Manning
%Effect of water level on n of Manning:

if smth_crs(lvl_ind1) < 0.3
N = 0.1;
elseif and(smth_crs(lvl_ind1) >= 0.3, smth_crs(lvl_ind1) < 0.7)
N = 0.06;
else
N = 0.03;
end

discharge1=(A(m)*(1/N)*R(m)^(2/3))*S(t)^(1/2);
discharge(m,1:2)=[lvl(m,2*t-1) discharge1];

end%end ‘for m=…’
% figure(‘Name’,[char(trib_name(t)) ‘_smth_crs’])
% plot(smth_crs)

discharge_all(1:size(discharge,1),2*t-1:2*t)=discharge;
% [discharge2,ia,~] = unique(discharge1(:,2));
% discharge=[lvl(ia,2*t-1) discharge2];
% discharge_all(1:size(discharge,1),2*t-1:2*t)=discharge;

% plot(date1,discharge_all);
n=t;
discharge_all(1:length(discharge),2*n-1:2*n)=discharge;
% figure(n)
% plot(discharge_all(1:Lng_lvl(n),2*n-1),discharge_all(1:Lng_lvl(n),2*n))
% title=trib_name(n);
% ylabel(‘Q (m^3/s)’)
% datetick

figure(‘name’,char(trib_name(t)))
plot(lvl(:,2*t-1),discharge_all(:,2*t),’.’)
%title(names(t));
ylabel(‘Q (m^3/s)’)
datetick
end

%end %end for t=, m=…
discharge_all_smth=discharge_all;
filename = ‘C:UsersuserDocumentsShulamitPhDMatlab_PhDHydrologyDischdischarge_all_smth.mat’;
save( filename, ‘discharge_all_smth’ );
toc Hi,
I am given a contineuous water level data measured and measured cross section to calculate discharge by Manning equation. All these data were checked for gaps, and found contineuous. When running the following script the discharge having gaps, creats a jump which looks strange. Tried for several weeks to find it, but didn’t. Hope for your help.
%this script reads Cross and crocss-sections data from tributaries:
%Tzipori, Yiftachel, Tzvi, Oz, Mizra, Adashim, Taanach and Keini
%It 1. reads divers data 2. change them to be water level 3. calculate
%discharge.
%Discharge calculation requires:
%1. find the water level in the current time step 2. caculate discharge using manning
tic
clear all
close all

%%%%%%%%%%%% Part A: find water level of all sites%%%%%%%%%%%%%%%%%%%
% Get a list of all txt files in the current folder, or subfolders of it.

%Read discharge
lines1 = readlines("trib_names.txt");
trib_name=(categorical(lines1));

for i=1:length(trib_name)
trib1{i}=trib_name(i)
end

trib=string(trib1)+’level’; %for the case of water level;
cd ‘C:UsersuserDocumentsShulamitPhDMatlab_PhDHydrologyDischdivers’;
lvl=NaN(418907,16);%columns: longest diver data, rows/2= # of tributaries. each st. ha two columns: for date and data of stations
AllDivresfiles = natsortfiles(dir(‘*.txt’));

for k =1:size(AllDivresfiles,1)
% k=5%shut ‘end’ at the end of loop. Find thie in ‘kishon_catchment_discharge_calc_for1trib’
thisfilename1 = AllDivresfiles(k).name; %just the name
thisdata1 = load(thisfilename1); %load just this file
Lng_lvl(k)=length(thisdata1);
date1=x2mdate(thisdata1(:,1));
%plot(date1,thisdata1(:,2));ylabel(‘Level (cm)’)
num_days=length(unique(thisdata1(:,1)));
interval=720;%720 is the daily period of the time interval of data: 2 min. length(thisdata1(:,1))/(num_days*24);%Model has 1 hours intervals, so this is the interval obtained here. Obtain intervals according to 10 min intrval
baseP=min(thisdata1(:,2));%background pressure
curr_lvl1=(thisdata1(:,2)-baseP)/100;%units change to meter%for smoothing turn curr_lvl to curr_lvl1
curr_lvl=smoothdata(curr_lvl1,’movmean’,interval);
%curr_lvl=smoothdata(curr_lvl,’gaussian’,interval);
lvl(1:size(thisdata1,1),(2*k-1):2*k)=[date1 curr_lvl];%Removing diver’s bias (correct only forephemeral tributaries) and converting to m
lngt(k)=length(curr_lvl);
end

in0=find((lvl)==0);
lvl(in0)=NaN;
figure(‘Name’,’Adashim’);adash=lvl(:,1:2);plot(adash(:,1),adash(:,2));datetick;title=’Adashim lvl’;
figure(‘Name’,’Keini’);keini=lvl(:,3:4);plot(keini(:,1),keini(:,2));title=’Keini lvl’;datetick;
figure(‘Name’,’KishonMaale’);KishonMaale=lvl(:,5:6);plot(KishonMaale(:,1),KishonMaale(:,2));title=’KishonMaale lvl’;datetick
figure(‘Name’,’Mizra’);mizra=lvl(:,7:8);plot(mizra(:,1),mizra(:,2));title=’Mizra lvl’;datetick;
figure(‘Name’,’Oz’);oz=lvl(:,9:10);plot(oz(:,1),oz(:,2));title=’Oz lvl’;datetick;
figure(‘Name’,’Taanach’);taanach=lvl(:,11:12);plot(taanach(:,1),taanach(:,2));title=’Taanach lvl’;datetick;
figure(‘Name’,’Tzvi’);title=’Tzvi lvl’;tzvi=lvl(:,13:14);plot(tzvi(:,1),tzvi(:,2));datetick;
figure(‘Name’,’Yiftachel’);title=’Yiftachel lvl’;yiftachel=lvl(:,15:16);plot(yiftachel(:,1),yiftachel(:,2));title=’Yiftachel lvl’;datetick;

%%%%%%%%%%%% Part B: find cross section%%%%%%%%%%%%%%%%%%%
%Read cross sections. In most tributaries the divers are in the downstream
%All files with ‘1’ are upstrream and all with ‘2’ are downstreaצ. For example: OzUp=Oz1, OzDown=Oz2

trib=length(AllDivresfiles);
cd ‘C:UsersuserDocumentsShulamitPhDMatlab_PhDHydrologyDischcrossectionsDownstream’;
crs=NaN(max(lngt),5*trib);%columns: longest cross section data, rows-# of stations*5
AllCrossfiles = natsortfiles(dir(‘*.txt’));
min_for_slope1=NaN(trib,3);

%Collect all downstream crossection data together
for l = 1:length(AllCrossfiles)
%l=1 %shut ‘end’ at the end of loop
thisfilename2 = AllCrossfiles(l).name; %just the name
thisdata2 = load(thisfilename2); %load current file
crs(1:length(thisdata2),5*l-4:l*5)=thisdata2;
[MIN,I0]=min(thisdata2(:,3));%sea level elevation to have absolute elevation
min_for_slope1(l,:)=thisdata2(I0,1:3);%The slope is obtained by the slope bwtween two min of adjacent croo sections.
Lng(l)=length(thisdata2);
% figure(‘Name’,[char(trib_name(l)) ‘_crs_dn’])
% plot(crs(:,5*l-4),crs(:,5*l))
end

% adash1_crs=crs(:,4:5);keini1_crs=crs(:,9:10);mizra1_crs=crs(:,14:15);oz1_crs=crs(:,19:20);taanach1_crs=crs(:,24:25);tzvi1_crs=crs(:,29:30);yiftachel1_crs=crs(:,34:35);
% figure(11);plot(adash1_crs(:,1),adash1_crs(:,2));figure(22); plot(keini1_crs(:,1),keini1_crs(:,2));figure(33);plot(mizra1_crs(:,1),mizra1_crs(:,2));figure(44);plot(oz1_crs(:,1),oz1_crs(:,2));figure(55);plot(taanach1_crs(:,1),taanach1_crs(:,2));figure(66);plot(tzvi1_crs(:,1),tzvi1_crs(:,2));figure(77);plot(yiftachel1_crs(:,1),yiftachel1_crs(:,2));

%%%%% Part B1: Reading upstream for slope%%%%%%%%
min_for_slope2=NaN(trib,3);%coordinates (columns 1 and 2) and elevation (column3). of minimum in the cross sectioncolumns: longest diver data, rows/2= # of tributaries. each st. ha two columns: for date and data of stations
cd ‘C:UsersuserDocumentsShulamitPhDMatlab_PhDHydrologyDischcrossections’;

%min_for_slope=NaN(trib*2,2);%columns: longest cross section data, rows-# of stations
Allupstrmfiles = orderfields(dir(‘*.txt’));
for j = 1 : trib
upstrmName = Allupstrmfiles(j).name; %just the name; j or l
thisupstrm = load(upstrmName); %load just this file
[MIN1,I1]=min(thisupstrm(:,3));%Sea level to get absolute elevation
min_for_slope2(j,:)=(thisupstrm(I1,1:3));
% figure(‘Name’,[char(trib_name(j)) ‘_crs_up’])
% plot(thisupstrm(:,4),thisupstrm(:,3))
end

%%%%%%%%%%%%%%%%NEW 29052025%%%%%%%%%%%%%%%%%%%%%%%%%%%
all_lvl=NaN(max(lngt),trib);
discharge_all=NaN(418907,trib*2);%longest data
discharge=NaN(418907,2);
g=0;
f=0;

for t=1:trib
x=crs(1:Lng(t),5*t-4);
y=crs(1:Lng(t),5*t-3);
crsc=crs(1:Lng(t),5*t);
x0=x(1);y0=y(1);
distance1=((x-x0).^2+(y-y0).^2).^(1/2);%crs(1:Lng(t),5*t-1);
%Interpolation to create smoother discharge calculation
DF=abs(min(crsc(1:length(crsc)-1)-crsc(2:length(crsc))))/300;%Order of magnitude of distance difference and elveation are similar
basic_distance=distance1(1):DF:distance1(end);
distance11=1:(length(crsc));
distance=interp1(distance11,distance1,basic_distance);%to do interpolation to distance , since t is not a stright line
smth_crs=interp1(distance1,crsc,distance);
% smth_x=interp1(distance1,x,distance);
% smth_y=interp1(distance1,y,distance);

for m=1:Lng_lvl(t)%m=233648

if isnan(lvl(m,2*t))
discharge(m,1:2)=[lvl(m,2*t-1) NaN];
f=f+1;
continue
end

[M lvl_ind1]=min(abs(lvl(m,2*t)-smth_crs));%Find current water level in lvl and the current cross section

if smth_crs(lvl_ind1)==min(smth_crs)
discharge(m,1:2)=[lvl(m,2*t-1) 0];
g=g+1;
continue
end

lvl_ind2=find(smth_crs<=smth_crs(lvl_ind1));
distance2=distance(lvl_ind2);smth_crs2=smth_crs(lvl_ind2);
P1=((distance2(2:end)-distance2(1:end-1)).^2+(smth_crs2(2:end)-smth_crs2(1:end-1)).^2).^(1/2);
% lvl_ind2=find(smth_crs<=smth_crs(lvl_ind1));
% lvl_ind22=crsc<=min(crsc);
% crsc_lvl=crsc(lvl_ind22);
% x_lvl=x(lvl_ind22);%Due to wetted perimeter.
% y_lvl=y(lvl_ind22);%Due to wetted perimeter.
% % smth_x_lvl=smth_x(lvl_ind2);%Due to wetted perimeter.
% % smth_y_lvl=smth_y(lvl_ind2);%Due to wetted perimeter.
% smth_crs_lvl=smth_crs(lvl_ind2);%Due to wetted perimeter.

%Wetted perimeter:
% P1=((x_lvl(2:end)-x_lvl(1:end-1)).^2+(y_lvl(2:end)-y_lvl(1:end-1)).^2+(crsc_lvl(2:end)-crsc_lvl(1:end-1)).^2).^(1/2);
P(m)=sum(P1);

if isnan(P(m))
discharge(m,1:2)=[lvl(m,2*t-1) 0];
q=q+1;
continue
end

%Slope
dx = min_for_slope2(t,1) – min_for_slope1(t,1);
dy = min_for_slope2(t,2) – min_for_slope1(t,2);
dz(t) = min_for_slope2(t,3) – min_for_slope1(t,3);
distance3D = sqrt(dx^2 + dy^2 + dz(t)^2);
S(t) = abs(dz(t)) / distance3D;
% S(t)=min_for_slope2(t,3)-min_for_slope1(t,3)/(min_for_slope2(t,1)-min_for_slope1(t,1))^2+(min_for_slope2(t,2)-min_for_slope1(t,2))^2+…
% (min_for_slope2(t,3)-min_for_slope1(t,3))^2;%Slope. Constant for crossection

%Area
A(m) = trapz(distance(lvl_ind2), smth_crs(lvl_ind1) – smth_crs(lvl_ind2)); % assumes smth_crs is bed elevation
%A(m)=trapz(distance-smth_crs);
R(m)=A(m)/P(m);%Hydraulic radius;

%Manning
%Effect of water level on n of Manning:

if smth_crs(lvl_ind1) < 0.3
N = 0.1;
elseif and(smth_crs(lvl_ind1) >= 0.3, smth_crs(lvl_ind1) < 0.7)
N = 0.06;
else
N = 0.03;
end

discharge1=(A(m)*(1/N)*R(m)^(2/3))*S(t)^(1/2);
discharge(m,1:2)=[lvl(m,2*t-1) discharge1];

end%end ‘for m=…’
% figure(‘Name’,[char(trib_name(t)) ‘_smth_crs’])
% plot(smth_crs)

discharge_all(1:size(discharge,1),2*t-1:2*t)=discharge;
% [discharge2,ia,~] = unique(discharge1(:,2));
% discharge=[lvl(ia,2*t-1) discharge2];
% discharge_all(1:size(discharge,1),2*t-1:2*t)=discharge;

% plot(date1,discharge_all);
n=t;
discharge_all(1:length(discharge),2*n-1:2*n)=discharge;
% figure(n)
% plot(discharge_all(1:Lng_lvl(n),2*n-1),discharge_all(1:Lng_lvl(n),2*n))
% title=trib_name(n);
% ylabel(‘Q (m^3/s)’)
% datetick

figure(‘name’,char(trib_name(t)))
plot(lvl(:,2*t-1),discharge_all(:,2*t),’.’)
%title(names(t));
ylabel(‘Q (m^3/s)’)
datetick
end

%end %end for t=, m=…
discharge_all_smth=discharge_all;
filename = ‘C:UsersuserDocumentsShulamitPhDMatlab_PhDHydrologyDischdischarge_all_smth.mat’;
save( filename, ‘discharge_all_smth’ );
toc hydrology manning water level gap in discharge MATLAB Answers — New Questions

​

Iterative Solution for Nonlinear System and Comparing Updated Coefficients
Matlab News

Iterative Solution for Nonlinear System and Comparing Updated Coefficients

PuTI / 2025-06-04

I am working with a nonlinear system of equations, where the term ( left| frac{partial phi_2′}{partial r} right| ) appears in the equations. I need to solve the system iteratively and compare the coefficients calculated using the initial assumption (with ( left| frac{partial phi_2′}{partial r} right| = 0 ) at first) with the updated coefficients obtained after several iterations.

The steps of the process are as follows:

begin{itemize}
item textbf{Step A:} Assume that the value of ( left| frac{partial phi_2′}{partial r} right| ) is known (set to 0 initially) and the coefficients ( c_n, c_n^-, d^0, d_n^+, d_n^- ) are unknown. The system of equations becomes linear and can be solved by Gaussian elimination.

item textbf{Step B:} After obtaining the initial solution, substitute the value of ( left| frac{partial phi_2′}{partial r} right| ) into the equation set and solve for all unknown coefficients, and update the value of ( left| frac{partial phi_2′}{partial r} right| ).

item textbf{Step C:} Calculate the updated unknown coefficients, and compare them with the values obtained in the previous iteration. If the difference between any coefficient is smaller than ( 10^{-3} ), stop the iteration and consider the solution as the final result. Otherwise, continue iterating, updating the value of ( left| frac{partial phi_2′}{partial r} right| ) in each step.
end{itemize}

How can I implement this iterative solution in MATLAB? Specifically, how can I calculate and compare the differences between the unknown coefficients obtained in each step using the initial and updated values of ( left| frac{partial phi_2′}{partial r} right| )?I am working with a nonlinear system of equations, where the term ( left| frac{partial phi_2′}{partial r} right| ) appears in the equations. I need to solve the system iteratively and compare the coefficients calculated using the initial assumption (with ( left| frac{partial phi_2′}{partial r} right| = 0 ) at first) with the updated coefficients obtained after several iterations.

The steps of the process are as follows:

begin{itemize}
item textbf{Step A:} Assume that the value of ( left| frac{partial phi_2′}{partial r} right| ) is known (set to 0 initially) and the coefficients ( c_n, c_n^-, d^0, d_n^+, d_n^- ) are unknown. The system of equations becomes linear and can be solved by Gaussian elimination.

item textbf{Step B:} After obtaining the initial solution, substitute the value of ( left| frac{partial phi_2′}{partial r} right| ) into the equation set and solve for all unknown coefficients, and update the value of ( left| frac{partial phi_2′}{partial r} right| ).

item textbf{Step C:} Calculate the updated unknown coefficients, and compare them with the values obtained in the previous iteration. If the difference between any coefficient is smaller than ( 10^{-3} ), stop the iteration and consider the solution as the final result. Otherwise, continue iterating, updating the value of ( left| frac{partial phi_2′}{partial r} right| ) in each step.
end{itemize}

How can I implement this iterative solution in MATLAB? Specifically, how can I calculate and compare the differences between the unknown coefficients obtained in each step using the initial and updated values of ( left| frac{partial phi_2′}{partial r} right| )? I am working with a nonlinear system of equations, where the term ( left| frac{partial phi_2′}{partial r} right| ) appears in the equations. I need to solve the system iteratively and compare the coefficients calculated using the initial assumption (with ( left| frac{partial phi_2′}{partial r} right| = 0 ) at first) with the updated coefficients obtained after several iterations.

The steps of the process are as follows:

begin{itemize}
item textbf{Step A:} Assume that the value of ( left| frac{partial phi_2′}{partial r} right| ) is known (set to 0 initially) and the coefficients ( c_n, c_n^-, d^0, d_n^+, d_n^- ) are unknown. The system of equations becomes linear and can be solved by Gaussian elimination.

item textbf{Step B:} After obtaining the initial solution, substitute the value of ( left| frac{partial phi_2′}{partial r} right| ) into the equation set and solve for all unknown coefficients, and update the value of ( left| frac{partial phi_2′}{partial r} right| ).

item textbf{Step C:} Calculate the updated unknown coefficients, and compare them with the values obtained in the previous iteration. If the difference between any coefficient is smaller than ( 10^{-3} ), stop the iteration and consider the solution as the final result. Otherwise, continue iterating, updating the value of ( left| frac{partial phi_2′}{partial r} right| ) in each step.
end{itemize}

How can I implement this iterative solution in MATLAB? Specifically, how can I calculate and compare the differences between the unknown coefficients obtained in each step using the initial and updated values of ( left| frac{partial phi_2′}{partial r} right| )? linear, system, equation, iteration MATLAB Answers — New Questions

​

How can I use table() with a variable number of columns?
Matlab News

How can I use table() with a variable number of columns?

PuTI / 2025-06-04

I’m making a set of tables from a 4x4x4 array, like so:
T{jj} = table(data(jj,:,1)’,data(jj,:,2)’,data(jj,:,3)’,data(jj,:,4)’,’VariableNames’,colName,’RowNames’,rowName);
The annoying thing is, I have to change this line every time there’s a different number of columns. For example, for 3 columns, the command is:
T{jj} = table(data(jj,:,1)’,data(jj,:,2)’,data(jj,:,3)’,’VariableNames’,colName,’RowNames’,rowName);
I know I could do a switch on the number of columns and have a case for every possible number of columns I might ever have, but is some way around that? The obvious solution of giving it the data as an array doesn’t work if you want named rows and columns:

T{jj} = table(data(jj,:,:),’VariableNames’,colName,’RowNames’,rowName);
Error using table (line 369)
The VariableNames property must contain one name for each variable in the table.

I get the exact same error back if I use slice():
T{jj} = table(slice(data(jj,:,:)),’VariableNames’,colName,’RowNames’,rowName);

But it works fine without row / column names
T{jj} = table(data(jj,:,:));
Am I missing something simple, or is this maybe a design oversight?I’m making a set of tables from a 4x4x4 array, like so:
T{jj} = table(data(jj,:,1)’,data(jj,:,2)’,data(jj,:,3)’,data(jj,:,4)’,’VariableNames’,colName,’RowNames’,rowName);
The annoying thing is, I have to change this line every time there’s a different number of columns. For example, for 3 columns, the command is:
T{jj} = table(data(jj,:,1)’,data(jj,:,2)’,data(jj,:,3)’,’VariableNames’,colName,’RowNames’,rowName);
I know I could do a switch on the number of columns and have a case for every possible number of columns I might ever have, but is some way around that? The obvious solution of giving it the data as an array doesn’t work if you want named rows and columns:

T{jj} = table(data(jj,:,:),’VariableNames’,colName,’RowNames’,rowName);
Error using table (line 369)
The VariableNames property must contain one name for each variable in the table.

I get the exact same error back if I use slice():
T{jj} = table(slice(data(jj,:,:)),’VariableNames’,colName,’RowNames’,rowName);

But it works fine without row / column names
T{jj} = table(data(jj,:,:));
Am I missing something simple, or is this maybe a design oversight? I’m making a set of tables from a 4x4x4 array, like so:
T{jj} = table(data(jj,:,1)’,data(jj,:,2)’,data(jj,:,3)’,data(jj,:,4)’,’VariableNames’,colName,’RowNames’,rowName);
The annoying thing is, I have to change this line every time there’s a different number of columns. For example, for 3 columns, the command is:
T{jj} = table(data(jj,:,1)’,data(jj,:,2)’,data(jj,:,3)’,’VariableNames’,colName,’RowNames’,rowName);
I know I could do a switch on the number of columns and have a case for every possible number of columns I might ever have, but is some way around that? The obvious solution of giving it the data as an array doesn’t work if you want named rows and columns:

T{jj} = table(data(jj,:,:),’VariableNames’,colName,’RowNames’,rowName);
Error using table (line 369)
The VariableNames property must contain one name for each variable in the table.

I get the exact same error back if I use slice():
T{jj} = table(slice(data(jj,:,:)),’VariableNames’,colName,’RowNames’,rowName);

But it works fine without row / column names
T{jj} = table(data(jj,:,:));
Am I missing something simple, or is this maybe a design oversight? table MATLAB Answers — New Questions

​

How to predefine no.of entites in a entity_batch_creator_block in simevents
Matlab News

How to predefine no.of entites in a entity_batch_creator_block in simevents

PuTI / 2025-06-04

I want entity_batch_creator block to take no. of entities from its previous block without explicitly defining it in the dialog box.

That is if for a specific time period no of entities generated are 20 then the entity batch creator takes the batch of 20 entities automatically.I want entity_batch_creator block to take no. of entities from its previous block without explicitly defining it in the dialog box.

That is if for a specific time period no of entities generated are 20 then the entity batch creator takes the batch of 20 entities automatically. I want entity_batch_creator block to take no. of entities from its previous block without explicitly defining it in the dialog box.

That is if for a specific time period no of entities generated are 20 then the entity batch creator takes the batch of 20 entities automatically. entity_batch_creator, aggregation MATLAB Answers — New Questions

​

PIL Simulation Warning: “Top model does not contain a referenced model” – Is My Simulation Valid?
Matlab News

PIL Simulation Warning: “Top model does not contain a referenced model” – Is My Simulation Valid?

PuTI / 2025-06-03

Hello,
I am performing a Processor-in-the-Loop (PIL) simulation on a control subsystem of a fuel-cell model using Simulink/Simscape and an STM32F429 target with Embedded Coder.
I used the option "Create SIL/PIL block" for the subsystem, followed by C/C++ Code > Build This Subsystem, and then added the generated block to my model for testing(fuel-cell model).
When I run the simulation, I get the following warning:
"Top model does not contain a referenced model. ‘Simulation’ and ‘SIL/PIL Simulation’ will behave in the same way. Change ‘system under test’ or add a model block to the top model."
At the same time, the simulation output curves for normal simulation and PIL are identical (confondues), which is expected, but this warning makes me unsure.
My questions:
Does this warning indicate that the PIL simulation is not actually running on the target hardware?
Since I’m testing only a control subsystem using a PIL block, and not the entire model, is it safe to ignore this warning?
Do I need to replace the subsystem with a referenced model (Model block) to properly use PIL at the top level?
Thank you in advance for your help!Hello,
I am performing a Processor-in-the-Loop (PIL) simulation on a control subsystem of a fuel-cell model using Simulink/Simscape and an STM32F429 target with Embedded Coder.
I used the option "Create SIL/PIL block" for the subsystem, followed by C/C++ Code > Build This Subsystem, and then added the generated block to my model for testing(fuel-cell model).
When I run the simulation, I get the following warning:
"Top model does not contain a referenced model. ‘Simulation’ and ‘SIL/PIL Simulation’ will behave in the same way. Change ‘system under test’ or add a model block to the top model."
At the same time, the simulation output curves for normal simulation and PIL are identical (confondues), which is expected, but this warning makes me unsure.
My questions:
Does this warning indicate that the PIL simulation is not actually running on the target hardware?
Since I’m testing only a control subsystem using a PIL block, and not the entire model, is it safe to ignore this warning?
Do I need to replace the subsystem with a referenced model (Model block) to properly use PIL at the top level?
Thank you in advance for your help! Hello,
I am performing a Processor-in-the-Loop (PIL) simulation on a control subsystem of a fuel-cell model using Simulink/Simscape and an STM32F429 target with Embedded Coder.
I used the option "Create SIL/PIL block" for the subsystem, followed by C/C++ Code > Build This Subsystem, and then added the generated block to my model for testing(fuel-cell model).
When I run the simulation, I get the following warning:
"Top model does not contain a referenced model. ‘Simulation’ and ‘SIL/PIL Simulation’ will behave in the same way. Change ‘system under test’ or add a model block to the top model."
At the same time, the simulation output curves for normal simulation and PIL are identical (confondues), which is expected, but this warning makes me unsure.
My questions:
Does this warning indicate that the PIL simulation is not actually running on the target hardware?
Since I’m testing only a control subsystem using a PIL block, and not the entire model, is it safe to ignore this warning?
Do I need to replace the subsystem with a referenced model (Model block) to properly use PIL at the top level?
Thank you in advance for your help! pil MATLAB Answers — New Questions

​

Previous 1 2 3 4 5 … 93 Next

Search

Categories

  • Matlab
  • Microsoft
  • News
  • Other
Application Package Repository Telkom University

Tags

matlab microsoft opensources
Application Package Download License

Application Package Download License

Adobe
Google for Education
IBM
Matlab
Microsoft
Wordpress
Visual Paradigm
Opensource

Sign Up For Newsletters

Be the First to Know. Sign up for newsletter today

Application Package Repository Telkom University

Portal Application Package Repository Telkom University, for internal use only, empower civitas academica in study and research.

Information

  • Telkom University
  • About Us
  • Contact
  • Forum Discussion
  • FAQ
  • Helpdesk Ticket

Contact Us

  • Ask: Any question please read FAQ
  • Mail: [email protected]
  • Call: +62 823-1994-9941
  • WA: +62 823-1994-9943
  • Site: Gedung Panambulai. Jl. Telekomunikasi

Copyright © Telkom University. All Rights Reserved. ch

  • FAQ
  • Privacy Policy
  • Term